#include <LiquidCrystal.h>
// Define the LCD pin connections
const int rs = 13; // Register Select pin
const int en = 14; // Enable pin
const int d4 = 19; // Data pin 4
const int d5 = 18; // Data pin 5
const int d6 = 21; // Data pin 6
const int d7 = 22; // Data pin 7
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
// Custom characters for heart, bell, alien, check, speaker, sound, skull, and lock symbols
byte heartSymbol[8] = {
B00000,
B01010,
B11111,
B11111,
B11111,
B01110,
B00100,
B00000
};
byte bellSymbol[8] = {
B00100,
B01110,
B01110,
B01110,
B11111,
B00000,
B00100,
B00000
};
byte alienSymbol[8] = {
B11111,
B10101,
B11111,
B11111,
B01110,
B01010,
B11011,
B00000
};
byte checkSymbol[8] = {
B00000,
B00001,
B00011,
B10110,
B11100,
B01000,
B00000,
B00000
};
byte speakerSymbol[8] = {
B00001,
B00011,
B01111,
B01111,
B01111,
B00011,
B00001,
B00000
};
byte soundSymbol[8] = {
B00001,
B00011,
B00101,
B01001,
B01001,
B01011,
B11011,
B11000
};
byte skullSymbol[8] = {
B00000,
B01110,
B10101,
B11011,
B01110,
B01110,
B00000,
B00000
};
byte lockSymbol[8] = {
B01110,
B10001,
B10001,
B11111,
B11111,
B11111,
B11111,
B11111
};
void setup() {
lcd.begin(16, 2); // Initialize the LCD with 16 columns and 2 rows
lcd.createChar(0, heartSymbol); // Create custom character for heart symbol
lcd.createChar(1, bellSymbol); // Create custom character for bell symbol
lcd.createChar(2, alienSymbol); // Create custom character for alien symbol
lcd.createChar(3, checkSymbol); // Create custom character for check symbol
lcd.createChar(4, speakerSymbol); // Create custom character for speaker symbol
lcd.createChar(5, soundSymbol); // Create custom character for sound symbol
lcd.createChar(6, skullSymbol); // Create custom character for skull symbol
lcd.createChar(7, lockSymbol); // Create custom character for lock symbol
lcd.clear();
}
void loop() {
// Display "Custom Character" on the 0th row
lcd.setCursor(0, 0);
lcd.print("Custom Character");
// Display symbols on the 1st row with spaces between them
lcd.setCursor(0, 1);
lcd.write((byte)0); // Heart symbol
lcd.print(" ");
lcd.write((byte)1); // Bell symbol
lcd.print(" ");
lcd.write((byte)2); // Alien symbol
lcd.print(" ");
lcd.write((byte)3); // Check symbol
lcd.print(" ");
lcd.write((byte)4); // Speaker symbol
lcd.print(" ");
lcd.write((byte)5); // Sound symbol
lcd.print(" ");
lcd.write((byte)6); // Skull symbol
lcd.print(" ");
lcd.write((byte)7); // Lock symbol
delay(2000); // Wait for 2 seconds before clearing the display
lcd.clear();
delay(1000); // Wait for 1 second before displaying the next set of symbols
}