#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#if defined(ARDUINO) && ARDUINO >= 100
#define printByte(args) write(args);
#else
#define printByte(args) print(args,BYTE);
#endif
uint8_t heart[8] = {
0b00000,
0b01010,
0b11111,
0b11111,
0b01110,
0b00100,
0b00000,
0b00000
};
LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup()
{
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.createChar(0, heart);
lcd.home();
lcd.print("Hello world...");
lcd.setCursor(0, 1);
lcd.print("I ");
lcd.printByte(0);
lcd.print(" I2C!");
delay(5000);
lcd.clear();
}
uint8_t i = 0;
void loop()
{
lcd.clear(); // Clear previous characters
// Print "Codes 0x00-0x10"
lcd.print("Codes 0x");
lcd.print(i, HEX);
lcd.print("-0x");
lcd.print(i+16, HEX);
lcd.setCursor(0, 1); // Set cursor at start of second row
for (int j = 0; j < 16; j++)
{
lcd.printByte(i+j);
}
i+=16;
delay(1000); // Wait so we can read the data
}