Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const byte zeile[] = {4, 5, 6, 7, 8};
- const byte spalte[] = {9, 10, 11, 12, 13};
- int timeCount = 0;
- const byte charTable[][30] = {
- {0b01100, 0b10010, 0b11110, 0b10010, 0b10010}, //A
- {0b11100, 0b10010, 0b11110, 0b10010, 0b11100}, //B
- {0b01110, 0b10000, 0b10000, 0b10000, 0b01110}, //C
- {0b11100, 0b10010, 0b10010, 0b10010, 0b11100}, //D
- {0b11110, 0b10000, 0b11100, 0b10000, 0b11110}, //E
- {0b11110, 0b10000, 0b11100, 0b10000, 0b10000}, //F
- {0b01110, 0b10000, 0b10110, 0b10010, 0b11110}, //G
- {0b10010, 0b10010, 0b11110, 0b10010, 0b10010}, //H
- {0b00100, 0b00100, 0b00100, 0b00100, 0b00100}, //I
- {0b00100, 0b00100, 0b00100, 0b10100, 0b11100}, //J
- {0b10010, 0b10100, 0b11000, 0b10100, 0b10010}, //K
- {0b10000, 0b10000, 0b10000, 0b10000, 0b11110}, //L
- {0b10001, 0b11011, 0b10101, 0b10001, 0b10001}, //M
- {0b10010, 0b11010, 0b10110, 0b10010, 0b10010}, //N
- {0b01100, 0b10010, 0b10010, 0b10010, 0b01100}, //O
- {0b11100, 0b10010, 0b10010, 0b11100, 0b10000}, //P
- {0b01110, 0b10001, 0b10101, 0b10010, 0b01101}, //Q
- {0b11100, 0b10010, 0b11100, 0b10010, 0b10010}, //R
- {0b11110, 0b10000, 0b11110, 0b00010, 0b11110}, //S
- {0b11111, 0b00100, 0b00100, 0b00100, 0b00100}, //T
- {0b10010, 0b10010, 0b10010, 0b10010, 0b01100}, //U
- {0b10001, 0b10001, 0b10001, 0b01010, 0b00100}, //V
- {0b10001, 0b10001, 0b10101, 0b10101, 0b01110}, //W
- {0b10010, 0b10010, 0b01100, 0b10010, 0b10010}, //X
- {0b10001, 0b10001, 0b01110, 0b00100, 0b00100}, //Y
- {0b11110, 0b00010, 0b00100, 0b01000, 0b11110}, //Z
- {0b00000, 0b00000, 0b00000, 0b00000, 0b00000}, //EX
- {0b11111, 0b11111, 0b11111, 0b11111, 0b11111}, //ALL
- {0b01010, 0b00000, 0b00100, 0b10001, 0b01110}, //smile
- {0b10001, 0b00100, 0b00000, 0b01110, 0b10001}, //frown
- };
- const byte firstChar = 'A'; // mit welchem Zeichen beginnt der charTable
- void setup() {
- Serial.begin(9600);
- for (size_t i = 0; i < sizeof(zeile); i++) {
- pinMode(zeile[i], OUTPUT);
- }
- for (size_t i = 0; i < sizeof(spalte); i++) {
- pinMode(spalte[i], OUTPUT);
- }
- }
- void loop() {
- char myStr[] = "OI"; // Variable mit dem anzuzeigenden Text
- wort(myStr, sizeof(myStr) - 1);
- }
- void wort(char *toPrint, size_t len)
- {
- for (size_t i = 0; i < len; i++)
- {
- // convert character to a variable
- byte myIndex = toPrint[i] - firstChar; // ASCII minus erstem Zeichen somit 0 für das erste Zeichen in deinem Char-Table
- // Hier beginnt das Drama -----------------------
- // meiner Meinung nch sollte er 1000x durchlaufen und das entsprechende Zeichen anzeigen
- // wenn 1000 erreicht ist geht der Zähler auf 0 und das nächste Zeichen kommt 1000 x
- // Tut er aber so nicht. Es werden beide Zeichen gleichzeitig gezeigt.
- if (timeCount < 1000)
- {
- timeCount ++;
- zeige(charTable[myIndex]);
- // Serial.println(timeCount); // sobald die ersten // entfernt werden bremst das Programm und die LEDs leuchten nur noch schwach.
- }
- else {
- timeCount = 0;
- }
- }
- }
- // ***** Ausgabe an die 5x5 LED MAtrix ******
- void zeige(const byte buffer2[]) {
- for (int a = 0; a <= 4; a++) {
- digitalWrite(zeile[a], 1);
- for (int i = 0; i < 5; i++) {
- digitalWrite(spalte[i], bitRead (buffer2[a], i));
- digitalWrite(spalte[i], 0);
- }
- digitalWrite(zeile[a], 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement