#include "Arduino.h"
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27
#define LCD_COLUMNS 16
#define LCD_LINES 2
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_LINES);
byte a3[8]= { B00011, //Defining an "ARRAY" of type "byte" for each 5*8 pixel of LCD. in total LCD has total of
B00111, //32 matrix of 5*8 pixels(16-TOP, 16-BOTTOM) each '1' will power ONE Pixel of each byte '0' will keep ONE pixel OFF.
B01100,
B11000,
B10000,
B00000,
B00000
};
/*how shapes can be created: //for example in the 4th row of of the Above ARRAY will work for first 5*8 matrix of LCD Top row
in this 4th row of the 5*8 matrix first 2 pixel will turn ON or you can see a BLACK DOT lit up
on the first 2 pixel and the remaining 3 will remain OFF. the process is
same for every other 5*8 matrix and you can program this and create any kind of
shape by giving '1' & '0' to each pixel. */
byte a2[8]= {B00000, //this is the 2nd array "a2" is just a name.
B00000,
B00000,
B00000,
B10001,
B11111,
B01110
};
byte a1[8]={B11000, //3rd array with name "a1".
B01100,
B00110,
B00011,
B00001,
B00000,
B00000
};
byte a4[8]={ B00000, //4th array with name "a4".
B00000,
B00000,
B00001,
B00011,
B00110,
B01100,
B11000
};
byte a5[8]={ B00000, //5th array with name "a5".
B01110,
B11111,
B10001,
B00000,
B00000,
B00000,
B01110,
B00000,
};
byte a6[8]={ B00000, //sixth array with name "a6".
B00000,
B00000,
B10000,
B11000,
B01100,
B00110,
B00011
};
byte a7[8]={ B00000, //seventh array with name "a7".
B01110,
B11111,
B10001,
B00000,
B00000,
B00000,
B00000,
};
byte a8[8]={B00100, //Eighth array with name "a8".
B01110,
B00100,
B00000,
B10001,
B11111,
B01110
};
// the following statements in "void setup" will get executed once
void setup()
{
lcd.begin(16, 2); //Creating an Object and naming it as "lcd".
lcd.print("Arduino"); //the message to be printed when LCD is powered. initially the cursor is on "ROW=1, COLUMN=0"
lcd.setCursor(1,1); //set the Location at where the next message(logo) will be printed in this its on "ROW=1 & COLUMN=1".
lcd.print("Logo"); //this message printed on ROW=1, COLUMN=1.
lcd.createChar(0,a1); //here we create a CUSTOM character for each 5*8 matrix in the brackets '0' is
//the number(as in counting such as 0,1,2...) of ARRAY and " a1 " is the NAME of ARRAY
lcd.createChar(1,a2); //the process is same for the rest of the CUSTOM CHARACTERS.
lcd.createChar(2,a3);
lcd.createChar(7,a8);
lcd.createChar(3,a4);
lcd.createChar(4,a5);
lcd.createChar(5,a6);
lcd.createChar(6,a7);
}
//the statements in "void loop" function will keep on Executing continously as long as Arduino is powered
void loop()
{
lcd.setCursor(10,0); //now we Set cursor on Position having COLUMN= 10 and ROW 0.
lcd.write(byte(3)); //this command will Display the data of array on location "3" or array "a4" on the LCD .
lcd.write(byte(4)); //this command will Display the data of array on location "4" or array "a5" on the LCD .
lcd.write(byte(5)); //this command will Display the data of array on location "5" or array "a6" on the LCD .
lcd.write(byte(3));
lcd.write(byte(6)); // we have to create another byte so that we can replace this byte
// with that and get the + design.
lcd.write(byte(5));
delay(2000); // just a 2 second delay before showing the LOWER HALF of the logo
lcd.setCursor(10,1); //set the cursor on column=1 and ROW=2 so to Display the LOWER half on this position.
lcd.write(byte(0)); //this command will Display the data of array on location "0" or array "a1" on the LCD .
lcd.write(byte(1)); //this command will Display the data of array on location "1" or array "a2" on the LCD .
lcd.write(byte(2)); //this command will Display the data of array on location "2" or array "a3" on the LCD .
lcd.write(byte(0)); //this command will Display the data of array on location "0" or array "a1" on the LCD .
lcd.write(byte(7)); // we have to create another byte so that we can replace this byte
// with that and get the - design.
lcd.write(byte(2)); //this command will Display the data of array on location "2" or array "a3" on the LCD .
}