/* * Programmer: R. Jordan Kreindler * August 8, 2020 * happyemoji animation */ #include LiquidCrystal_I2C lcd(0x27, 16, 2); // Set I2C address to 0x27 byte happyemoji0[] = { // Setup custom character in matrix B00000, B11011, B11011, B00100, B00100, B00000, B01110, B10001 }; byte happyemoji1[] = { // Setup custom character in matrix B00000, B11011, B11011, B00100, B00100, B00000, B11111, B00000 }; byte happyemoji2[] = { // Setup custom character in matrix B00000, B11011, B11011, B00100, B00100, B10001, B10001, B01110 }; int delay1 = 1500; // Set delay, so custom character can be seen printing void setup() { lcd.init(); // Initilize the LCD lcd.backlight(); // Turn the LCD backlight On lcd.createChar(0, happyemoji0); // Create custom character and assign to zero (0) lcd.createChar(1, happyemoji1); // Create custom character and assign to one (1) lcd.createChar(2, happyemoji2); // Create custom character and assign to two (2) // Can use values zero(0) through seven(7). That is, eight custom characters. lcd.setCursor(2, 0); // Set cursor at 1st line (line zero (0)) at position two (2) lcd.clear(); lcd.print(" An Animation "); // Display "An Animation" on 1st line of LCD lcd.setCursor(7, 1); // Set cursor on 2nd line (line one (1))at position 7 lcd.write(0); delay(delay1); } void loop() { lcd.setCursor(7, 1); // Set cursor on 2nd line (line one (1))at position 7 lcd.write(0); delay(delay1); lcd.setCursor(7, 1); // Set cursor on 2nd line (line one (1))at position 7 lcd.write(1); delay(delay1); // Add delay so custom characters can be seen displayed lcd.setCursor(7, 1); // Set cursor on 2nd line (line one (1))at position 7 lcd.write(2); delay(delay1); // Add delay so custom characters can be seen displayed }