virtual pet | progress: lcd screen works !
I made some of my own characters using this :
byte customChar1[8] = { 0b01110, 0b10011, 0b10011, 0b11111, 0b01110, 0b00000, 0b00000, 0b00000 }; byte customChar2[8] = { 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b10001, 0b01110 }; byte customChar3[8] = { 0b00000, 0b00000, 0b01110, 0b01010, 0b01110, 0b00000, 0b00000, 0b00000 }; byte customChar4[8] = { 0b00011, 0b00011, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000 }; byte customChar5[8] = { 0b00100, 0b01010, 0b01010, 0b10001, 0b10001, 0b01010, 0b01010, 0b00100 }; byte customChar6[8] = { 0b00001, 0b00001, 0b00010, 0b00010, 0b00100, 0b01100, 0b11000, 0b00000 };
I created each character by declaring its class in the setup, along with its name and corresponding number, then printed it character by character, line by line:
void setup() { lcd.createChar(0, customChar1); lcd.createChar(1, customChar2); lcd.createChar(3, customChar3); lcd.createChar(4, customChar4); lcd.createChar(5, customChar5); lcd.createChar(6, customChar6); lcd.begin(16, 2); lcd.print("("); lcd.print((char)6); lcd.print((char)0); lcd.print((char)1); lcd.print((char)0); lcd.print(" )"); lcd.print((char)6); lcd.print((char)3); lcd.print("*:"); lcd.print((char)3); lcd.print((char)4); lcd.print((char)5); }
In the loop function, I moved to the bottom row and am displaying a timer:
void loop() { lcd.setCursor(0, 1); lcd.print(millis() / 1000); }
Here’s a video with the screen hooked up to a potentiometer, which controls the backlight: