#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
LiquidCrystal_I2C lcd (0x27, 6, 2);
const byte r = 4;
const byte c = 4;
byte rp[r] = {5, 4, 3, 2};
byte rc[c] = {A3, A2, A1, A0};
byte cc=0;
char keys[r][c] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'.', '0', '=', 'D'}
};
Keypad keypad = Keypad(makeKeymap(keys), rp, rc, r, c);
byte small[8] = {
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00100
};
byte medium[8] = {
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00100,
0b00100,
0b00100
};
byte big[8] = {
0b00000,
0b00000,
0b00100,
0b01110,
0b00100,
0b00100,
0b00100,
0b00100
};
byte armsDown[8] = {
0b00100,
0b01010,
0b00100,
0b00100,
0b01110,
0b10101,
0b00100,
0b01010
};
byte armsUp[8] = {
0b00100,
0b01010,
0b00100,
0b10101,
0b01110,
0b00100,
0b00100,
0b01010
};
byte pop[8] = {
0b00000,
0b00100,
0b01110,
0b11111,
0b01110,
0b00100,
0b00100,
0b00100
};
void setup() {
lcd.begin(16,2);
lcd.setCursor(1,0);
lcd.init();
lcd.backlight();
lcd.createChar(0, small);
// create a new character
lcd.createChar(1, medium);
// create a new character
lcd.createChar(2, big);
// create a new character
lcd.createChar(3, armsDown);
// create a new character
lcd.createChar(4, armsUp);
// create a new character
lcd.createChar(5, pop);
// create a new character
lcd.write(byte(0)); // when calling lcd.write() '0' must be cast as a byte
lcd.print(" Arduino! ");
lcd.write((byte)1);
}
void loop() {
char key = keypad.getKey();
int sensorReading = analogRead(A0);
// map the result to 200 - 1000:
// set the cursor to the bottom row, 5th position:
lcd.setCursor(8, 1);
lcd.setCursor(1,0);
lcd.print("Happy New Year");
lcd.setCursor(6,1);
lcd.print("2025");
lcd.setCursor(3,1);
lcd.write(3);
lcd.setCursor(12,1);
lcd.write(3);
delay(250);
lcd.setCursor(3,1);
lcd.write(4);
lcd.setCursor(12,1);
lcd.write(3);
lcd.setCursor(1,1);
lcd.write(0);
lcd.setCursor(14,1);
lcd.write(0);
delay(250);
lcd.setCursor(3,1);
lcd.write(3);
lcd.setCursor(12,1);
lcd.write(4);
lcd.setCursor(14,1);
lcd.write(1);
lcd.setCursor(1,1);
lcd.write(1);
delay(250);
lcd.setCursor(3,1);
lcd.write(4);
lcd.setCursor(12,1);
lcd.write(3);
lcd.setCursor(14,1);
lcd.write(2);
lcd.setCursor(1,1);
lcd.write(2);
delay(250);
lcd.setCursor(3,1);
lcd.write(3);
lcd.setCursor(12,1);
lcd.write(4);
lcd.setCursor(14,1);
lcd.write(5);
lcd.setCursor(1,1);
lcd.write(5);
delay(250);
lcd.setCursor(3,1);
lcd.write(4);
lcd.setCursor(12,1);
lcd.write(3);
lcd.setCursor(14,1);
lcd.print("*");
lcd.setCursor(1,1);
lcd.print("*");
delay(250);
lcd.setCursor(3,1);
lcd.write(4);
lcd.setCursor(12,1);
lcd.write(4);
lcd.setCursor(14,1);
lcd.print(" ");
lcd.setCursor(1,1);
lcd.print(" ");
delay(250);
}