/*
/ Program for writing to NHD-2.7-12864 OLED with SSD1322 controller with Serial Interface
/ This code is written for the Arduino Due using Serial Interface
/
/ Newhaven Display invests time and resources providing this open source code,
/ Please support Newhaven Display by purchasing products from Newhaven Display!
* Copyright (c) 2023, Newhaven Display International
*
* This code is provided as an example only and without any warranty by Newhaven Display.
* Newhaven Display accepts no responsibility for any issues resulting from its use.
* The developer of the final application incorporating any parts of this
* sample code is responsible for ensuring its safe and correct operation
* and for any consequences resulting from its use.
* See the GNU General Public License for more details.
*
* Use Horizontal Orientation when converting BMP to hex code to display custom image using LCD assistant.
*/
//---------------------------------------------------------
#define OLED_DC 49 //Register Select signal
#define OLED_RESET 48 //Reset signal
#define OLED_CS 47 //Chip select signal
#define OLED_CLK 52 //Serial clock signal
#define OLED_MOSI 51 //Serial data signal
/****************************************************
* Hex Table for Image Pic *
*****************************************************/
unsigned char NHD_Logo [] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xFF, 0xFF, 0xD9, 0x83, 0xC6, 0x31, 0x98, 0xC1, 0x82, 0x0C, 0x3C, 0x63, 0x00, 0x00, 0x00, 0x00, 0xFF,
0xFF, 0xD9, 0x87, 0xC6, 0x33, 0x98, 0xC1, 0x83, 0x0C, 0x7C, 0x73, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x1D, 0x86,
0x03, 0x33, 0x18, 0xC3, 0xC3, 0x18, 0xC0, 0x7B, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x7F, 0xDD, 0x8E, 0xE3, 0x7B, 0x1F,
0xC3, 0x61, 0xB8, 0xFC, 0x7B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xDF, 0x8F, 0xC1, 0xDF, 0x1F, 0xC6, 0x61, 0xB1,
0xFC, 0x6F, 0x00, 0x00, 0x00, 0x3C, 0x01, 0xC0, 0x1B, 0x84, 0x01, 0xCE, 0x18, 0xC7, 0xE0, 0xF0, 0xC0, 0x67, 0x00,
0x00, 0x00, 0x7E, 0x07, 0x9F, 0xDB, 0x87, 0xE1, 0xCE, 0x18, 0xCE, 0x70, 0xE0, 0x7C, 0x67, 0x00, 0x00, 0x00, 0x7F,
0xFE, 0x3F, 0xD9, 0x83, 0xE0, 0xCC, 0x18, 0xCC, 0x38, 0x60, 0x3C, 0x63, 0x00, 0x00, 0x00, 0xFF, 0xFC, 0xE0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x01, 0xC0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x3C, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x07, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1F, 0x80, 0x0E, 0x00, 0x3F, 0x0C, 0x3F, 0x8F, 0xC3, 0x00, 0xC3, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3F,
0xFF, 0xFC, 0x00, 0x3F, 0x8C, 0x3F, 0x8C, 0xE3, 0x01, 0xC3, 0x98, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xF8, 0x00,
0x31, 0xCC, 0x30, 0x0C, 0x63, 0x01, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x80, 0x00, 0x00, 0x30, 0xCC, 0x3F,
0x0E, 0xC3, 0x03, 0x20, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x30, 0xCC, 0x03, 0x8F, 0xC3, 0x03,
0xF0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x8C, 0x3F, 0x8C, 0x03, 0x07, 0xF0, 0x60, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x8C, 0x3F, 0x0C, 0x03, 0xE6, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x83, 0x41, 0xE0, 0x70, 0x78, 0x24, 0x0C,
0x0F, 0x06, 0x0F, 0x06, 0x81, 0x80, 0x80, 0x00, 0x01, 0x83, 0xC0, 0xC0, 0xE0, 0x58, 0x34, 0x0C, 0x06, 0x06, 0x09,
0x07, 0x81, 0x80, 0x80, 0x00, 0x01, 0x82, 0xC0, 0xC0, 0xC0, 0x70, 0x3C, 0x1E, 0x06, 0x06, 0x09, 0x05, 0x83, 0xC0,
0x80, 0x00, 0x01, 0x82, 0x40, 0xC0, 0x70, 0x58, 0x2C, 0x12, 0x06, 0x06, 0x0F, 0x04, 0x82, 0x40, 0xE0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
/****************************************************
* Function Commands *
*****************************************************/
void data(unsigned char d) //Data Output Serial Interface
{
unsigned int n;
digitalWrite(OLED_CS, LOW);
digitalWrite(OLED_DC, HIGH);
for(n=0;n<8;n++){
if((d&0x80)==0x80)
digitalWrite(OLED_MOSI, HIGH);
else
digitalWrite(OLED_MOSI, LOW);
while(0);
d=(d<<1);
digitalWrite(OLED_CLK, LOW);
while(0);
digitalWrite(OLED_CLK, HIGH);
while(0);
digitalWrite(OLED_CLK, LOW);
}
digitalWrite(OLED_CS, HIGH);
}
void command(unsigned char d) //Command Output Serial Interface
{
unsigned int n;
digitalWrite(OLED_CS, LOW);
digitalWrite(OLED_DC, LOW);
for(n=0;n<8;n++){
if((d&0x80)==0x80)
digitalWrite(OLED_MOSI, HIGH);
else
digitalWrite(OLED_MOSI, LOW);
while(0);
d=(d<<1);
digitalWrite(OLED_CLK, LOW);
while(0);
digitalWrite(OLED_CLK, HIGH);
while(0);
digitalWrite(OLED_CLK, LOW);
}
digitalWrite(OLED_CS, HIGH);
}
/****************************************************
* Display Commands *
*****************************************************/
void Set_Column_Address_12864(unsigned char a, unsigned char b)
{
command(0x15); // Set Column Address
data(a); // Default => 0x00
data(b); // Default => 0x77
}
//--------------------------------------------------------------------------
void Set_Write_RAM_12864()
{
command(0x5C); // Enable MCU to Write DATA RAM
}
//--------------------------------------------------------------------------
void Set_Row_Address_12864(unsigned char a, unsigned char b)
{
command(0x75); // Set Row Start and End Address
data(a); // Default => 0x00
data(b); // Default => 0x7F
}
//--------------------------------------------------------------------------
void Set_Remap_12864(unsigned char a, unsigned char b)
{
command(0xA0); // Set Remap
data(a); // Default => 0x00
data(b); // Default => 0x00
}
//--------------------------------------------------------------------------
void Set_Display_Start_Line_12864(unsigned char a)
{
command(0xA1); // Set Display RAM Display Start Line
data(a); // Default => 0x00
}
//--------------------------------------------------------------------------
void Set_Display_Offset_12864(unsigned char a)
{
command(0xA2); // Set Verticle Shift
data(a); // Default => 0x00
}
//--------------------------------------------------------------------------
void Display_Mode_12864(unsigned char a)
{
command(a); // 0xA4 => Entire Display OFF
// 0xA5 => Entire Display ON, all pixels Grayscale level 15
// 0xA6 => Normal Display (Default)
// 0xA7 => Inverse Display
}
//--------------------------------------------------------------------------
void Enable_Partial_Display_12864(unsigned char a, unsigned char b)
{
command(0xA8); // Turns ON partial mode
data(a); // Address of start row
data(b); // Address of end row.
}
//--------------------------------------------------------------------------
void Exit_Partial_Display_12864()
{
command(0xA9); // Exit Partial Display Mode
}
//--------------------------------------------------------------------------
void Function_Selection_12864(unsigned char a)
{
command(0xAB); // Function Selection
data(a); // Default => 0x01
}
//--------------------------------------------------------------------------
void Set_Sleep_Mode_12864(unsigned char a)
{
command(a); // 0xAE => Sleep Mode ON
// 0xAF => Sleep Mode OFF
}
//--------------------------------------------------------------------------
void Set_Phase_Length_12864(unsigned char a)
{
command(0xB1); // Set Phase Length
data(a); // Default => 0x97
}
//--------------------------------------------------------------------------
void Set_Display_Clock__Oscillator_Frequency_12864(unsigned char a)
{
command(0xB3); // Set Osc Frequency
data(a); //
}
//--------------------------------------------------------------------------
void Enable_External_VSL(unsigned char a, unsigned char b)
{
command(0xB4); // Enable External VSL
data(a); //
data(b); //
}
//--------------------------------------------------------------------------
void Set_GPIO_12864(unsigned char a)
{
command(0xB5); // Set GPIO
data(a); //
}
//--------------------------------------------------------------------------
void Set_Second_Precharge_Period_12864(unsigned char a)
{
command(0xB6); // Set Second Precharge Period
data(a); //
}
//--------------------------------------------------------------------------
void Default_Grayscale_Command_12864()
{
command(0xB9); // Sets Default Grayscale
}
//--------------------------------------------------------------------------
void Set_Precharge_Voltage_12864(unsigned char a)
{
command(0xBB); // Set Precharge Voltage Level
data(a); // Default => 0x17
}
//--------------------------------------------------------------------------
void Set_VCOMH_Voltage_12864(unsigned char a)
{
command(0xBE); // Set Second Precharge Period
data(a); // Default => 0x04
}
//--------------------------------------------------------------------------
void Set_Contrast_Control_12864(unsigned char a)
{
command(0xC1); // Set Contrast Control Level
data(a); // Default => 0x7F
}
//--------------------------------------------------------------------------
void Master_Contrast_Control_12864(unsigned char a)
{
command(0xC7); // Master Contrast Control
data(a); // Default => 0x0F
}
//--------------------------------------------------------------------------
void Set_Multiplex_Ratio_12864(unsigned char a)
{
command(0xCA); // Set MUX Ratio
data(a); // Default => 0x7F
}
//--------------------------------------------------------------------------
void Display_Enhancement_12864(unsigned char a)
{
command(0xD1); // Display Enhancement
data(a); //
data(0x20); //
}
//--------------------------------------------------------------------------
void Set_Command_Lock_12864(unsigned char a)
{
command(0xFD); // Set Lock/Unlock Commands
data(a); // Default => 0x12
}
//--------------------------------------------------------------------------
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Show Blank (Clear Screen)
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void ClearPixel_12864()
{
unsigned int i, j;
Set_Column_Address_12864(0x1C,0x5B);
Set_Row_Address_12864(0x00,0x3F);
Set_Write_RAM_12864();
for(i=0;i<64;i++) //Columns
{
for(j=0;j<128;j++) //Rows
{
data(0x00);
delayMicroseconds(100);
}
}
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Show Checkboard (Full Screen)
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void FillPixel_12864()
{
unsigned int i, j;
Set_Column_Address_12864(0x1C,0x5B); //1C & 5B = DISPLAY Start & End address.
Set_Row_Address_12864(0x00,0x3F);
Set_Write_RAM_12864();
for(i=0;i<32;i++) //Columns
{
for(j=0;j<64;j++) //Rows
{
data(0xFF);
delayMicroseconds(100);
data(0x00);
delayMicroseconds(100);
}
for(j=0;j<64;j++) //Rows
{
data(0x00);
delayMicroseconds(100);
data(0xFF);
delayMicroseconds(100);
}
}
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Show Image (Full Screen)
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Driver IC Mapping = 256x64 (2 SEG Lines Tied to 1 COM Line to form 1 Pixel)
// 8 bits (1 Byte) = 1 Pixel.
// Function parses through Hex Table Data and spreads 1 Byte of data over 8 Pixels.
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void ImageDisplay_12864(unsigned char *image)
{
unsigned int i, l, n, buff;
//Set_Remap_12864(0x04,0x11); //To flip 180 degrees
Set_Column_Address_12864(0x1C,0x5B);
Set_Row_Address_12864(0x00,0x3F);
Set_Write_RAM_12864();
for(i=0;i<1024;i++){
buff = *image;
n = 7;
for(l=0;l<8;l++){
if((buff >> n) & 0x80 == 0x80){
data(0xFF);
}
else{
data(0x00);
}
n--;
}
image++;
}
}
/****************************************************
* Initialization For controller *
*****************************************************/
void OLED_Init_12864()
{
Set_Sleep_Mode_12864(0xAF); // Display OFF
Set_Command_Lock_12864(0x12); // Unlock commands for OLED
Set_Display_Clock__Oscillator_Frequency_12864(0x91); // Set Display Clock / Oscillator Frequency
Set_Multiplex_Ratio_12864(0x3F); // Set Multiplex Ratio
Set_Display_Offset_12864(0x00); // Set Display Offset
Function_Selection_12864(0x01); // Function Selection
Set_Display_Start_Line_12864(0x00); // Set Display Start Line
Set_Remap_12864(0x16,0x11); // Set Remap. (A[1]) & (A[4]) can be adjusted to flip display orientation
Master_Contrast_Control_12864(0x0F); // Master Contrast Control
Set_Contrast_Control_12864(0x9F); // Set Contrast Control
Set_Phase_Length_12864(0x72); // Set Phase Length
Set_Precharge_Voltage_12864(0x1F); // Set Precharge Voltage
Enable_External_VSL(0xA0,0xFD); // Enable External VSL
Set_VCOMH_Voltage_12864(0x04); // Set VCOMH Voltage
Display_Mode_12864(0xA6); // Set Normal Display
Exit_Partial_Display_12864(); // Exit Partial Display Mode
Display_Enhancement_12864(0xA2); // Display Enhancement
Set_GPIO_12864(0x00); // Set GPIO
Default_Grayscale_Command_12864(); // Default Linear Grayscale Table
Set_Second_Precharge_Period_12864(0x08); // Set Second Precharge Period
Set_Sleep_Mode_12864(0xAF); // Display ON
}
/*****************************************************
* Setup Function, to run once *
*****************************************************/
void setup()
{
pinMode(OLED_CLK, OUTPUT);
pinMode(OLED_MOSI, OUTPUT);
pinMode(OLED_DC, OUTPUT);
pinMode(OLED_RESET, OUTPUT);
pinMode(OLED_CS, OUTPUT);
digitalWrite(OLED_RESET, LOW);
delay(150);
digitalWrite(OLED_RESET, HIGH);
delay(150);
OLED_Init_12864(); //Initialization Sequence
delay(10);
}
/*****************************************************
* Loop Function, to run repeatedly *
*****************************************************/
void loop() {
FillPixel_12864();
delay(1000); //1 second delay
ClearPixel_12864();
delay(250); //1/4 second delay
ImageDisplay_12864(NHD_Logo);
delay(2000); //2 second delay
command(0xA7);
delay(2000); //2 second delay
command(0xA6);
delay(2000); //2 second delay
ClearPixel_12864();
delay(250); //1/4 second delay
}