#include <LCD_I2C.h>
LCD_I2C lcd(0x27,20,4);
// siehe: https://forum.arduino.cc/t/wie-bekommt-man-solch-grosse-zahlen-hin/986148/3
byte largeLetterPart0[8] = {
B00000,
B00000,
B00000,
B00000,
B00001,
B00111,
B01111,
B11111,
};
byte largeLetterPart1[8] = {
B00000,
B00000,
B00000,
B00000,
B11111,
B11111,
B11111,
B11111,
};
byte largeLetterPart2[8] = {
B00000,
B00000,
B00000,
B00000,
B10000,
B11100,
B11110,
B11111,
};
byte largeLetterPart3[8] = {
B11111,
B01111,
B00111,
B00001,
B00000,
B00000,
B00000,
B00000,
};
byte largeLetterPart4[8] = {
B11111,
B11111,
B11111,
B11111,
B00000,
B00000,
B00000,
B00000,
};
byte largeLetterPart5[8] = {
B11111,
B11110,
B11100,
B10000,
B00000,
B00000,
B00000,
B00000,
};
byte largeLetterPart6[8] = {
B11111,
B11111,
B11111,
B11111,
B11111,
B01111,
B00111,
B00001,
};
byte largeLetterPart7[8] = {
B11111,
B11111,
B11111,
B11111,
B11111,
B11110,
B11100,
B10000,
};
byte digitData[4][30] = {
// 0 1 2 3 4 5 6 7 8 9
{0, 1, 2, ' ', 0, 1, 0, 1, 2, 0, 1, 2, 0, ' ', 1, 1, 1, 1, 0, 1, 2, 1, 1, 1, 0, 1, 2, 0, 1, 2},
{255, 0, 255, ' ', 5, 255, 4, 0, 7, 4, 0, 7, 255, ' ', 255, 6, 1, 2, 255, 1, 2, ' ', 0, 7, 6, 1, 7, 6, 1, 255},
{255, 5, 255, ' ', ' ', 255, 255, 5, ' ', 1, 3, 255, 4, 4, 255, 1, ' ', 255, 255, ' ', 255, 255, 5, ' ', 255, ' ', 255, ' ', ' ', 255},
{3, 4, 5, ' ', ' ', 4, 4, 4, 4, 3, 4, 5, ' ', ' ', 4, 3, 4, 5, 3, 4, 5, 4, ' ', ' ', 3, 4, 5, 3, 4, 5},
};
void writeLargeDigit(byte column, byte digit) {
byte index = (digit % 10) * 3;
for (byte row = 0; row < 4; row++) {
lcd.setCursor(column, row);
for (byte i = 0; i < 3; i++) {
lcd.write(digitData[row][index + i]);
}
}
};
void setup() {
lcd.begin(); // initialize the lcd
lcd.backlight();
lcd.createChar(0, largeLetterPart0);
lcd.createChar(1, largeLetterPart1);
lcd.createChar(2, largeLetterPart2);
lcd.createChar(3, largeLetterPart3);
lcd.createChar(4, largeLetterPart4);
lcd.createChar(5, largeLetterPart5);
lcd.createChar(6, largeLetterPart6);
lcd.createChar(7, largeLetterPart7);
lcd.print("Hallo");
}
void loop() {
delay(2000);
lcd.clear();
writeLargeDigit(0, 0);
writeLargeDigit(4, 1);
writeLargeDigit(8, 2);
writeLargeDigit(12, 3);
writeLargeDigit(16, 4);
delay(2000);
lcd.clear();
writeLargeDigit(0, 5);
writeLargeDigit(4, 6);
writeLargeDigit(8, 7);
writeLargeDigit(12, 8);
writeLargeDigit(16, 9);
}