Hardware components | ||||||
![]() |
| × | 1 | |||
| × | 1 | ||||
![]() |
| × | 1 | |||
![]() |
| × | 1 |
Overview
Read moreI wanted to make something for a daily use. And thought why don't I make a clock.
But while searching for people who had already built one, I didn't find any that can be adjusted manually. So here we are, my Arduino Matrix Clock that can be set manually.
It's still a prototype tho, I'm looking forward to building a case and add some extras like an alarm, etc.
DemoHere you can see what the Clock already can do:
#include <Wire.h>
#include "LedControl.h"
#include "RTClib.h"
RTC_DS1307 rtc;
LedControl lc = LedControl(12, 11, 10, 4); //pin12=DataIn , pin11=CLK , pin10=LOAD
int t1 = 2;
int t2 = 3;
int t3 = 4;
int tag = 8; int monat = 2; int jahr = 2000; int stunde = 14; int minuten = 30; int sekunden = 0;
int modus = 0;
int auswahl;
int ziffer0;
int ziffer1;
int ziffer2;
int ziffer3;
unsigned long passedMillis;
int blinkTime=600;
int blinkDelay=300;
//MatrixByteDatumNummern
byte nR00[8] = {B00000000, B01110000, B10001000, B10011000, B10101000, B11001000, B10001000, B01110100}; //0 R
byte nR10[8] = {B00000000, B00100000, B01100000, B10100000, B00100000, B00100000, B00100000, B11111010}; //1 R
byte nR20[8] = {B00000000, B01110000, B10001000, B00001000, B00010000, B00100000, B01000000, B11111010}; //2 R
byte nR30[8] = {B00000000, B01110000, B10001000, B00001000, B00110000, B00001000, B10001000, B01110010}; //3 R
byte nR40[8] = {B00000000, B00010000, B00110000, B01010000, B10010000, B11111000, B00010000, B00010010}; //4 R
byte nR50[8] = {B00000000, B11111000, B10000000, B11110000, B00001000, B00001000, B10001000, B01110010}; //5 R
byte nR60[8] = {B00000000, B01110000, B10001000, B10000000, B11110000, B10001000, B10001000, B01110010}; //6 R
byte nR70[8] = {B00000000, B11111000, B00001000, B00010000, B00100000, B01000000, B01000000, B01000010}; //7 R
byte nR80[8] = {B00000000, B01110000, B10001000, B10001000, B01110000, B10001000, B10001000, B01110010}; //8 R
byte nR90[8] = {B00000000, B01110000, B10001000, B10001000, B01111000, B00001000, B10001000, B01110010}; //9 R
byte nL00[8] = {B00000000, B00011100, B00100010, B00100110, B00101010, B00110010, B00100010, B00011100}; //0 L
byte nL10[8] = {B00000000, B00001000, B00011000, B00101000, B00001000, B00001000, B00001000, B00111110}; //1 L
byte nL20[8] = {B00000000, B00011100, B00100010, B00000010, B00000100, B00001000, B00010000, B00111110}; //2 L
byte nL30[8] = {B00000000, B00011100, B00100010, B00000010, B00001100, B00000010, B00100010, B00011100}; //3 L
//MatrixByteDatumMonate
byte m010[8] = {B00000000, B00000000, B00000000, B11111001, B00010010, B00010100, B10010111, B01100100}; //Jan Teil 1
byte m011[8] = {B00000000, B00000000, B00000000, B00100010, B10110010, B01101010, B11100110, B01100010}; //Jan Teil 2
byte m020[8] = {B00000000, B00000000, B00000000, B11110111, B10000100, B11100111, B10000100, B10000111}; //Feb Teil 1
byte m021[8] = {B00000000, B00000000, B00000000, B10111100, B00100010, B00111100, B00100010, B10111100}; //Feb Teil 2
byte m030[8] = {B00000000, B00000000, B00000000, B10001001, B11011010, B10101100, B10001111, B10001100}; //Mr Teil 1
byte m031[8] = {B00000000, B00000000, B00000000, B00111100, B10100010, B01111100, B11100010, B01100010}; //Mr Teil 2
byte m040[8] = {B00000000, B00000000, B00000000, B00100111, B01010100, B10001111, B11111100, B10001100}; //Apr Teil 1
byte m041[8] = {B00000000, B00000000, B00000000, B10111100, B01100010, B10111100, B00100010, B00100010}; //Apr Teil 2
byte m050[8] = {B00000000, B00000000, B00000000, B10001001, B11011010, B10101100, B10001111, B10001100}; //Mai Teil 1
byte m051[8] = {B00000000, B00000000, B00000000, B00111110, B10001000, B01001000, B11001000, B01111110}; //Mai Teil 2
byte m060[8] = {B00000000, B00000000, B00000000, B11111100, B00010100, B00010100, B10010100, B01100011}; //Jun Teil 1
byte m061[8] = {B00000000, B00000000, B00000000, B01100010, B01110010, B01101010, B01100110, B10100010}; //Jun Teil 2
byte m070[8] = {B00000000, B00000000, B00000000, B11111100, B00010100, B00010100, B10010100, B01100011}; //Jul Teil 1
byte m071[8] = {B00000000, B00000000, B00000000, B01100000, B01100000, B01100000, B01100000, B10111110}; //Jul Teil 2
byte m080[8] = {B00000000, B00000000, B00000000, B00100100, B01010100, B10001100, B11111100, B10001011}; //Aug Teil 1
byte m081[8] = {B00000000, B00000000, B00000000, B01011110, B01100000, B01100110, B01100010, B10011110}; //Aug Teil 2
byte m090[8] = {B00000000, B00000000, B00000000, B01111111, B10000100, B01110111, B00001100, B11110111}; //Sep Teil 1
byte m091[8] = {B00000000, B00000000, B00000000, B10111100, B00100010, B00111100, B00100000, B10100000}; //Sep Teil 2
byte m100[8] = {B00000000, B00000000, B00000000, B01110100, B10001100, B10001111, B10001100, B01110100}; //Okt Teil 1
byte m101[8] = {B00000000, B00000000, B00000000, B01111110, B10001000, B00001000, B10001000, B01001000}; //Okt Teil 2
byte m110[8] = {B00000000, B00000000, B00000000, B10001011, B11001100, B10101100, B10011100, B10001011}; //Nov Teil 1
byte m111[8] = {B00000000, B00000000, B00000000, B10100010, B01100010, B01100010, B01010100, B10001000}; //Nov Teil 2
byte m120[8] = {B00000000, B00000000, B00000000, B11110111, B10001100, B10001111, B10001100, B11110111}; //Dez Teil 1
byte m121[8] = {B00000000, B00000000, B00000000, B10111110, B00000100, B00001000, B00010000, B10111110}; //Dez Teil 2
//MatrixByteUhrzeit
byte c0_0[8] = {B00000000, B01110000, B10001000, B10011000, B10101000, B11001000, B10001000, B01110000}; //Matrix 0 - 0
byte c1_0[8] = {B00000000, B00011100, B10100010, B10100110, B00101010, B10110010, B10100010, B00011100}; //Matrix 1 - 0
byte c2_0[8] = {B00000000, B00111000, B01000101, B01001101, B01010100, B01100101, B01000101, B00111000}; //Matrix 2 - 0
byte c3_0[8] = {B00000000, B00001110, B00010001, B00010011, B00010101, B00011001, B00010001, B00001110}; //Matrix 3 - 0
byte c0_1[8] = {B00000000, B00100000, B01100000, B10100000, B00100000, B00100000, B00100000, B11111000}; //Matrix 0 - 1
byte c1_1[8] = {B00000000, B00001000, B10011000, B10101000, B00001000, B10001000, B10001000, B00111110}; //Matrix 1 - 1
byte c2_1[8] = {B00000000, B00010000, B00110001, B01010001, B00010000, B00010001, B00010001, B01111100}; //Matrix 2 - 1
byte c3_1[8] = {B00000000, B00000100, B00001100, B00010100, B00000100, B00000100, B00000100, B00011111}; //Matrix 3 - 1
byte c0_2[8] = {B00000000, B01110000, B10001000, B00001000, B00010000, B00100000, B01000000, B11111000}; //Matrix 0 - 2
byte c1_2[8] = {B00000000, B00011100, B10100010, B10000010, B00000100, B10001000, B10010000, B00111110}; //Matrix 1 - 2
byte c2_2[8] = {B00000000, B00111000, B01000101, B00000101, B00001000, B00010001, B00100001, B01111100}; //Matrix 2 - 2
byte c3_2[8] = {B00000000, B00001110, B00010001, B00000001, B00000010, B00000100, B00001000, B00011111}; //Matrix 3 - 2
byte c0_3[8] = {B00000000, B01110000, B10001000, B00001000, B00110000, B00001000, B10001000, B01110000}; //Matrix 0 - 3
byte c1_3[8] = {B00000000, B00011100, B10100010, B10000010, B00001100, B10000010, B10100010, B00011100}; //Matrix 1 - 3
byte c2_3[8] = {B00000000, B00111000, B01000101, B00000101, B00011000, B00000101, B01000101, B00111000}; //Matrix 2 - 3
byte c3_3[8] = {B00000000, B00001110, B00010001, B00000001, B00000110, B00000001, B00010001, B00001110}; //Matrix 3 - 3
byte c0_4[8] = {B00000000, B00010000, B00110000, B01010000, B10010000, B11111000, B00010000, B00010000}; //Matrix 0 - 4
byte c1_4[8] = {B00000000, B00000100, B10001100, B10010100, B00100100, B10111110, B10000100, B00000100}; //Matrix 1 - 4
byte c2_4[8] = {B00000000, B00001000, B00011001, B00101001, B01001000, B01111101, B00001001, B00001000}; //Matrix 2 - 4
byte c3_4[8] = {B00000000, B00000010, B00000110, B00001010, B00010010, B00011111, B00000010, B00000010}; //Matrix 3 - 4
byte c0_5[8] = {B00000000, B11111000, B10000000, B11110000, B00001000, B00001000, B10001000, B01110000}; //Matrix 0 - 5
byte c1_5[8] = {B00000000, B00111110, B10100000, B10111100, B00000010, B10000010, B10100010, B00011100}; //Matrix 1 - 5
byte c2_5[8] = {B00000000, B01111100, B01000001, B01111001, B00000100, B00000101, B01000101, B00111000}; //Matrix 2 - 5
byte c3_5[8] = {B00000000, B00011111, B00010000, B00011110, B00000001, B00000001, B00010001, B00001110}; //Matrix 3 - 5
byte c0_6[8] = {B00000000, B01110000, B10001000, B10000000, B11110000, B10001000, B10001000, B01110000}; //Matrix 0 - 6
byte c1_6[8] = {B00000000, B00011100, B10100010, B10100000, B00111100, B10100010, B10100010, B00011100}; //Matrix 1 - 6
byte c2_6[8] = {B00000000, B00111000, B01000101, B01000001, B01111000, B01000101, B01000101, B00111000}; //Matrix 2 - 6
byte c3_6[8] = {B00000000, B00001110, B00010001, B00010000, B00011110, B00010001, B00010001, B00001110}; //Matrix 3 - 6
byte c0_7[8] = {B00000000, B11111000, B00001000, B00010000, B00100000, B01000000, B01000000, B01000000}; //Matrix 0 - 7
byte c1_7[8] = {B00000000, B00111110, B10000010, B10000100, B00001000, B10010000, B10010000, B00010000}; //Matrix 1 - 7
byte c2_7[8] = {B00000000, B01111100, B00000101, B00001001, B00010000, B00100001, B00100001, B00100000}; //Matrix 2 - 7
byte c3_7[8] = {B00000000, B00011111, B00000001, B00000010, B00000100, B00001000, B00001000, B00001000}; //Matrix 3 - 7
byte c0_8[8] = {B00000000, B01110000, B10001000, B10001000, B01110000, B10001000, B10001000, B01110000}; //Matrix 0 - 8
byte c1_8[8] = {B00000000, B00011100, B10100010, B10100010, B00011100, B10100010, B10100010, B00011100}; //Matrix 1 - 8
byte c2_8[8] = {B00000000, B00111000, B01000101, B01000101, B00111000, B01000101, B01000101, B00111000}; //Matrix 2 - 8
byte c3_8[8] = {B00000000, B00001110, B00010001, B00010001, B00001110, B00010001, B00010001, B00001110}; //Matrix 3 - 8
byte c0_9[8] = {B00000000, B01110000, B10001000, B10001000, B01111000, B00001000, B10001000, B01110000}; //Matrix 0 - 9
byte c1_9[8] = {B00000000, B00011100, B10100010, B10100010, B00011110, B10000010, B10100010, B00011100}; //Matrix 1 - 9
byte c2_9[8] = {B00000000, B00111000, B01000101, B01000101, B00111100, B00000101, B01000101, B00111000}; //Matrix 2 - 9
byte c3_9[8] = {B00000000, B00001110, B00010001, B00010001, B00001111, B00000001, B00010001, B00001110}; //Matrix 3 - 9
//ByteSec
byte sec1[8] = {B00000000, B00000000, B00000000, B01111111, B10000100, B01110111, B00001100, B11110111}; //Sec Teil 1
byte sec2[8] = {B00000000, B00000000, B00000000, B10111100, B00100000, B00100000, B00100000, B10111100}; //Sec Teil 2
void setup() {
Serial.begin(9600);
auswahl = 0;
pinMode(t1, INPUT);
pinMode(t2, INPUT);
pinMode(t3, INPUT);
//wake up the MAX72XX from power-saving mode
lc.shutdown(0, false);
lc.shutdown(1, false);
lc.shutdown(2, false);
lc.shutdown(3, false);
//set a medium brightness for the Leds
lc.setIntensity(0, 1);
lc.setIntensity(1, 1);
lc.setIntensity(2, 1);
lc.setIntensity(3, 1);
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}
if (! rtc.isrunning()) {
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
//rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
rtc.adjust(DateTime(jahr, monat, tag, stunde, minuten, sekunden));
}
/*
DateTime now = rtc.now();
sekunden = now.second(); minuten = now.minute(); stunde = now.hour(); tag = now.day(); monat = now.month(); jahr = now.year();
*/
}
void loop() {
Uhrstellen();
Modus();
}
void Modus() {
if (digitalRead(t2) == HIGH) {
modus = 0;
}
if (digitalRead(t3) == HIGH) {
modus = 1;
}
if (modus == 0) {
BerechnungDatumAnzeige();
setDay();
setMonth();
}
if (modus == 1) {
BerechnungZeitZiffernAnzeige();
setMin();
setHour();
}
}
void Uhrstellen() {
DateTime now = rtc.now();
passedMillis = millis();
while (digitalRead(t1) == HIGH) {
sekunden = now.second(); minuten = now.minute(); stunde = now.hour(); tag = now.day(); monat = now.month(); jahr = now.year();
delay(blinkTime);
while (auswahl == 0) {
if (digitalRead(t2) == HIGH) {
jahr++;
delay(200);
}
if (digitalRead(t3) == HIGH) {
jahr--;
delay(200);
}
if (digitalRead(t1) == HIGH) {
rtc.adjust(DateTime(jahr, monat, tag, stunde, minuten, sekunden));
lc.shutdown(0, false);
lc.shutdown(1, false);
lc.shutdown(2, false);
lc.shutdown(3, false);
auswahl = 1;
delay(200);
}
Anzeige2();
}
while (auswahl == 1) {
if (digitalRead(t2) == HIGH) {
monat++;
delay(200);
}
if (digitalRead(t3) == HIGH) {
monat--;
delay(200);
}
if (monat < 1) {
monat = 12;
}
if (monat > 12) {
monat = 1;
}
if (digitalRead(t1) == HIGH) {
rtc.adjust(DateTime(jahr, monat, tag, stunde, minuten, sekunden));
lc.shutdown(0, false);
lc.shutdown(1, false);
auswahl = 2;
delay(200);
}
Anzeige2();
}
while (auswahl == 2) {
if (digitalRead(t2) == HIGH) {
tag++;
delay(200);
}
if (digitalRead(t3) == HIGH) {
tag--;
delay(200);
}
if (tag < 1) {
tag = 31;
}
if (tag > 31) {
tag = 1;
}
if (digitalRead(t1) == HIGH) {
rtc.adjust(DateTime(jahr, monat, tag, stunde, minuten, sekunden));
lc.shutdown(2, false);
lc.shutdown(3, false);
auswahl = 3;
delay(200);
}
Anzeige2();
}
while (auswahl == 3) {
if (digitalRead(t2) == HIGH) {
stunde++;
delay(200);
}
if (digitalRead(t3) == HIGH) {
stunde--;
delay(200);
}
if (stunde < 0) {
stunde = 23;
}
if (stunde > 23) {
stunde = 0;
}
if (digitalRead(t1) == HIGH) {
rtc.adjust(DateTime(jahr, monat, tag, stunde, minuten, sekunden));
lc.shutdown(2, false);
lc.shutdown(3, false);
auswahl = 4;
delay(200);
}
Anzeige2();
}
while (auswahl == 4) {
if (digitalRead(t2) == HIGH) {
minuten++;
delay(200);
}
if (digitalRead(t3) == HIGH) {
minuten--;
delay(200);
}
if (minuten < 0) {
minuten = 59;
}
if (minuten > 59) {
minuten = 0;
}
if (digitalRead(t1) == HIGH) {
rtc.adjust(DateTime(jahr, monat, tag, stunde, minuten, sekunden));
lc.shutdown(0, false);
lc.shutdown(1, false);
auswahl = 5;
delay(200);
}
Anzeige2();
}
while (auswahl == 5) {
if (digitalRead(t2) == HIGH) {
sekunden++;
delay(200);
}
if (digitalRead(t3) == HIGH) {
sekunden--;
delay(200);
}
if (sekunden < 0) {
sekunden = 59;
}
if (sekunden > 59) {
sekunden = 0;
}
if (digitalRead(t1) == HIGH) {
rtc.adjust(DateTime(jahr, monat, tag, stunde, minuten, sekunden));
lc.shutdown(2, false);
lc.shutdown(3, false);
auswahl = 0;
delay(200);
}
Anzeige2();
}
lc.shutdown(0, false);
lc.shutdown(1, false);
lc.shutdown(2, false);
lc.shutdown(3, false);
auswahl = 0;
}
}
void Anzeige2() {
if (auswahl == 0) {
BerechnungJahrZiffern();
setMin();
setHour();
if ((millis() - passedMillis) >= blinkTime) {
passedMillis = millis();
}
if ((millis() - passedMillis) > blinkDelay) {
lc.shutdown(0, true);
lc.shutdown(1, true);
lc.shutdown(2, true);
lc.shutdown(3, true);
}
if ((millis() - passedMillis) < blinkDelay) {
lc.shutdown(0, false);
lc.shutdown(1, false);
lc.shutdown(2, false);
lc.shutdown(3, false);
}
}
if (auswahl == 1) {
MonatEinstellen();
BerechnungDatumAnzeige2();
setDay();
if ((millis() - passedMillis) >= blinkTime) {
passedMillis = millis();
}
if ((millis() - passedMillis) > blinkDelay) {
lc.shutdown(0, true);
lc.shutdown(1, true);
}
if ((millis() - passedMillis) < blinkDelay) {
lc.shutdown(0, false);
lc.shutdown(1, false);
}
}
if (auswahl == 2) {
BerechnungDatumAnzeige2();
setDay();
if ((millis() - passedMillis) >= blinkTime) {
passedMillis = millis();
}
if ((millis() - passedMillis) > blinkDelay) {
lc.shutdown(2, true);
lc.shutdown(3, true);
}
if ((millis() - passedMillis) < blinkDelay) {
lc.shutdown(2, false);
lc.shutdown(3, false);
}
}
if (auswahl == 3) {
BerechnungStdMin();
setMin();
setHour();
if ((millis() - passedMillis) >= blinkTime) {
passedMillis = millis();
}
if ((millis() - passedMillis) > blinkDelay) {
lc.shutdown(2, true);
lc.shutdown(3, true);
}
if ((millis() - passedMillis) < blinkDelay) {
lc.shutdown(2, false);
lc.shutdown(3, false);
}
}
if (auswahl == 4) {
BerechnungStdMin();
setMin();
setHour();
if ((millis() - passedMillis) >= blinkTime) {
passedMillis = millis();
}
if ((millis() - passedMillis) > blinkDelay) {
lc.shutdown(0, true);
lc.shutdown(1, true);
}
if ((millis() - passedMillis) < blinkDelay) {
lc.shutdown(0, false);
lc.shutdown(1, false);
}
}
if (auswahl == 5) {
BerechnungSecZiffern();
setHour();
sekundenAnzeige();
if ((millis() - passedMillis) >= blinkTime) {
passedMillis = millis();
}
if ((millis() - passedMillis) > blinkDelay) {
lc.shutdown(2, true);
lc.shutdown(3, true);
}
if ((millis() - passedMillis) < blinkDelay) {
lc.shutdown(2, false);
lc.shutdown(3, false);
}
}
}
void BerechnungZeitZiffernAnzeige() {
DateTime now = rtc.now();
ziffer1 = now.minute() / 10; //Wert fr Matrix 1
ziffer0 = now.minute() - ziffer1 * 10; //Wert fr Matrix 0
ziffer3 = now.hour() / 10; //Wert fr Matrix 3
ziffer2 = now.hour() - ziffer3 * 10; //Wert fr Matrix 2
}
void BerechnungJahrZiffern() {
ziffer3 = jahr / 1000; //Wert fr Matrix 3
ziffer2 = (jahr - ziffer3 * 1000) / 100; //Wert fr Matrix 2
ziffer1 = (jahr - ziffer3 * 1000 - ziffer2 * 100) / 10; //Wert fr Matrix 1
ziffer0 = jahr - ziffer3 * 1000 - ziffer2 * 100 - ziffer1 * 10; //Wert fr Matrix 0
}
void BerechnungSecZiffern() {
ziffer3 = sekunden / 10;
ziffer2 = sekunden - ziffer3 * 10;
}
void BerechnungStdMin() {
DateTime now = rtc.now();
ziffer1 = minuten / 10; //Wert fr Matrix 1
ziffer0 = minuten - ziffer1 * 10; //Wert fr Matrix 0
ziffer3 = stunde / 10; //Wert fr Matrix 3
ziffer2 = stunde - ziffer3 * 10; //Wert fr Matrix 2
}
void sekundenAnzeige() {
lc.setRow(1, 0, sec1[0]);
lc.setRow(1, 1, sec1[1]);
lc.setRow(1, 2, sec1[2]);
lc.setRow(1, 3, sec1[3]);
lc.setRow(1, 4, sec1[4]);
lc.setRow(1, 5, sec1[5]);
lc.setRow(1, 6, sec1[6]);
lc.setRow(1, 7, sec1[7]);
lc.setRow(0, 0, sec2[0]);
lc.setRow(0, 1, sec2[1]);
lc.setRow(0, 2, sec2[2]);
lc.setRow(0, 3, sec2[3]);
lc.setRow(0, 4, sec2[4]);
lc.setRow(0, 5, sec2[5]);
lc.setRow(0, 6, sec2[6]);
lc.setRow(0, 7, sec2[7]);
}
void BerechnungDatumAnzeige() {
DateTime now = rtc.now();
//Tag
ziffer3 = now.day() / 10;
ziffer2 = now.day() - ziffer3 * 10;
}
void BerechnungDatumAnzeige2() {
//Tag
ziffer3 = tag / 10;
ziffer2 = tag - ziffer3 * 10;
}
void setMin() {
DateTime now = rtc.now();
if (ziffer0 == 0) {
lc.setRow(0, 0, c0_0[0]);
lc.setRow(0, 1, c0_0[1]);
lc.setRow(0, 2, c0_0[2]);
lc.setRow(0, 3, c0_0[3]);
lc.setRow(0, 4, c0_0[4]);
lc.setRow(0, 5, c0_0[5]);
lc.setRow(0, 6, c0_0[6]);
lc.setRow(0, 7, c0_0[7]);
}
if (ziffer0 == 1) {
lc.setRow(0, 0, c0_1[0]);
lc.setRow(0, 1, c0_1[1]);
lc.setRow(0, 2, c0_1[2]);
lc.setRow(0, 3, c0_1[3]);
lc.setRow(0, 4, c0_1[4]);
lc.setRow(0, 5, c0_1[5]);
lc.setRow(0, 6, c0_1[6]);
lc.setRow(0, 7, c0_1[7]);
}
if (ziffer0 == 2) {
lc.setRow(0, 0, c0_2[0]);
lc.setRow(0, 1, c0_2[1]);
lc.setRow(0, 2, c0_2[2]);
lc.setRow(0, 3, c0_2[3]);
lc.setRow(0, 4, c0_2[4]);
lc.setRow(0, 5, c0_2[5]);
lc.setRow(0, 6, c0_2[6]);
lc.setRow(0, 7, c0_2[7]);
}
if (ziffer0 == 3) {
lc.setRow(0, 0, c0_3[0]);
lc.setRow(0, 1, c0_3[1]);
lc.setRow(0, 2, c0_3[2]);
lc.setRow(0, 3, c0_3[3]);
lc.setRow(0, 4, c0_3[4]);
lc.setRow(0, 5, c0_3[5]);
lc.setRow(0, 6, c0_3[6]);
lc.setRow(0, 7, c0_3[7]);
}
if (ziffer0 == 4) {
lc.setRow(0, 0, c0_4[0]);
lc.setRow(0, 1, c0_4[1]);
lc.setRow(0, 2, c0_4[2]);
lc.setRow(0, 3, c0_4[3]);
lc.setRow(0, 4, c0_4[4]);
lc.setRow(0, 5, c0_4[5]);
lc.setRow(0, 6, c0_4[6]);
lc.setRow(0, 7, c0_4[7]);
}
if (ziffer0 == 5) {
lc.setRow(0, 0, c0_5[0]);
lc.setRow(0, 1, c0_5[1]);
lc.setRow(0, 2, c0_5[2]);
lc.setRow(0, 3, c0_5[3]);
lc.setRow(0, 4, c0_5[4]);
lc.setRow(0, 5, c0_5[5]);
lc.setRow(0, 6, c0_5[6]);
lc.setRow(0, 7, c0_5[7]);
}
if (ziffer0 == 6) {
lc.setRow(0, 0, c0_6[0]);
lc.setRow(0, 1, c0_6[1]);
lc.setRow(0, 2, c0_6[2]);
lc.setRow(0, 3, c0_6[3]);
lc.setRow(0, 4, c0_6[4]);
lc.setRow(0, 5, c0_6[5]);
lc.setRow(0, 6, c0_6[6]);
lc.setRow(0, 7, c0_6[7]);
}
if (ziffer0 == 7) {
lc.setRow(0, 0, c0_7[0]);
lc.setRow(0, 1, c0_7[1]);
lc.setRow(0, 2, c0_7[2]);
lc.setRow(0, 3, c0_7[3]);
lc.setRow(0, 4, c0_7[4]);
lc.setRow(0, 5, c0_7[5]);
lc.setRow(0, 6, c0_7[6]);
lc.setRow(0, 7, c0_7[7]);
}
if (ziffer0 == 8) {
lc.setRow(0, 0, c0_8[0]);
lc.setRow(0, 1, c0_8[1]);
lc.setRow(0, 2, c0_8[2]);
lc.setRow(0, 3, c0_8[3]);
lc.setRow(0, 4, c0_8[4]);
lc.setRow(0, 5, c0_8[5]);
lc.setRow(0, 6, c0_8[6]);
lc.setRow(0, 7, c0_8[7]);
}
if (ziffer0 == 9) {
lc.setRow(0, 0, c0_9[0]);
lc.setRow(0, 1, c0_9[1]);
lc.setRow(0, 2, c0_9[2]);
lc.setRow(0, 3, c0_9[3]);
lc.setRow(0, 4, c0_9[4]);
lc.setRow(0, 5, c0_9[5]);
lc.setRow(0, 6, c0_9[6]);
lc.setRow(0, 7, c0_9[7]);
}
if (ziffer1 == 0) {
lc.setRow(1, 0, c1_0[0]);
lc.setRow(1, 1, c1_0[1]);
lc.setRow(1, 2, c1_0[2]);
lc.setRow(1, 3, c1_0[3]);
lc.setRow(1, 4, c1_0[4]);
lc.setRow(1, 5, c1_0[5]);
lc.setRow(1, 6, c1_0[6]);
lc.setRow(1, 7, c1_0[7]);
}
if (ziffer1 == 1) {
lc.setRow(1, 0, c1_1[0]);
lc.setRow(1, 1, c1_1[1]);
lc.setRow(1, 2, c1_1[2]);
lc.setRow(1, 3, c1_1[3]);
lc.setRow(1, 4, c1_1[4]);
lc.setRow(1, 5, c1_1[5]);
lc.setRow(1, 6, c1_1[6]);
lc.setRow(1, 7, c1_1[7]);
}
if (ziffer1 == 2) {
lc.setRow(1, 0, c1_2[0]);
lc.setRow(1, 1, c1_2[1]);
lc.setRow(1, 2, c1_2[2]);
lc.setRow(1, 3, c1_2[3]);
lc.setRow(1, 4, c1_2[4]);
lc.setRow(1, 5, c1_2[5]);
lc.setRow(1, 6, c1_2[6]);
lc.setRow(1, 7, c1_2[7]);
}
if (ziffer1 == 3) {
lc.setRow(1, 0, c1_3[0]);
lc.setRow(1, 1, c1_3[1]);
lc.setRow(1, 2, c1_3[2]);
lc.setRow(1, 3, c1_3[3]);
lc.setRow(1, 4, c1_3[4]);
lc.setRow(1, 5, c1_3[5]);
lc.setRow(1, 6, c1_3[6]);
lc.setRow(1, 7, c1_3[7]);
}
if (ziffer1 == 4) {
lc.setRow(1, 0, c1_4[0]);
lc.setRow(1, 1, c1_4[1]);
lc.setRow(1, 2, c1_4[2]);
lc.setRow(1, 3, c1_4[3]);
lc.setRow(1, 4, c1_4[4]);
lc.setRow(1, 5, c1_4[5]);
lc.setRow(1, 6, c1_4[6]);
lc.setRow(1, 7, c1_4[7]);
}
if (ziffer1 == 5) {
lc.setRow(1, 0, c1_5[0]);
lc.setRow(1, 1, c1_5[1]);
lc.setRow(1, 2, c1_5[2]);
lc.setRow(1, 3, c1_5[3]);
lc.setRow(1, 4, c1_5[4]);
lc.setRow(1, 5, c1_5[5]);
lc.setRow(1, 6, c1_5[6]);
lc.setRow(1, 7, c1_5[7]);
}
if (ziffer1 == 6) {
lc.setRow(1, 0, c1_6[0]);
lc.setRow(1, 1, c1_6[1]);
lc.setRow(1, 2, c1_6[2]);
lc.setRow(1, 3, c1_6[3]);
lc.setRow(1, 4, c1_6[4]);
lc.setRow(1, 5, c1_6[5]);
lc.setRow(1, 6, c1_6[6]);
lc.setRow(1, 7, c1_6[7]);
}
if (ziffer1 == 7) {
lc.setRow(1, 0, c1_7[0]);
lc.setRow(1, 1, c1_7[1]);
lc.setRow(1, 2, c1_7[2]);
lc.setRow(1, 3, c1_7[3]);
lc.setRow(1, 4, c1_7[4]);
lc.setRow(1, 5, c1_7[5]);
lc.setRow(1, 6, c1_7[6]);
lc.setRow(1, 7, c1_7[7]);
}
if (ziffer1 == 8) {
lc.setRow(1, 0, c1_8[0]);
lc.setRow(1, 1, c1_8[1]);
lc.setRow(1, 2, c1_8[2]);
lc.setRow(1, 3, c1_8[3]);
lc.setRow(1, 4, c1_8[4]);
lc.setRow(1, 5, c1_8[5]);
lc.setRow(1, 6, c1_8[6]);
lc.setRow(1, 7, c1_8[7]);
}
if (ziffer1 == 9) {
lc.setRow(1, 0, c1_9[0]);
lc.setRow(1, 1, c1_9[1]);
lc.setRow(1, 2, c1_9[2]);
lc.setRow(1, 3, c1_9[3]);
lc.setRow(1, 4, c1_9[4]);
lc.setRow(1, 5, c1_9[5]);
lc.setRow(1, 6, c1_9[6]);
lc.setRow(1, 7, c1_9[7]);
}
}
void setHour() {
DateTime now = rtc.now();
if (ziffer2 == 0) {
lc.setRow(2, 0, c2_0[0]);
lc.setRow(2, 1, c2_0[1]);
lc.setRow(2, 2, c2_0[2]);
lc.setRow(2, 3, c2_0[3]);
lc.setRow(2, 4, c2_0[4]);
lc.setRow(2, 5, c2_0[5]);
lc.setRow(2, 6, c2_0[6]);
lc.setRow(2, 7, c2_0[7]);
}
if (ziffer2 == 1) {
lc.setRow(2, 0, c2_1[0]);
lc.setRow(2, 1, c2_1[1]);
lc.setRow(2, 2, c2_1[2]);
lc.setRow(2, 3, c2_1[3]);
lc.setRow(2, 4, c2_1[4]);
lc.setRow(2, 5, c2_1[5]);
lc.setRow(2, 6, c2_1[6]);
lc.setRow(2, 7, c2_1[7]);
}
if (ziffer2 == 2) {
lc.setRow(2, 0, c2_2[0]);
lc.setRow(2, 1, c2_2[1]);
lc.setRow(2, 2, c2_2[2]);
lc.setRow(2, 3, c2_2[3]);
lc.setRow(2, 4, c2_2[4]);
lc.setRow(2, 5, c2_2[5]);
lc.setRow(2, 6, c2_2[6]);
lc.setRow(2, 7, c2_2[7]);
}
if (ziffer2 == 3) {
lc.setRow(2, 0, c2_3[0]);
lc.setRow(2, 1, c2_3[1]);
lc.setRow(2, 2, c2_3[2]);
lc.setRow(2, 3, c2_3[3]);
lc.setRow(2, 4, c2_3[4]);
lc.setRow(2, 5, c2_3[5]);
lc.setRow(2, 6, c2_3[6]);
lc.setRow(2, 7, c2_3[7]);
}
if (ziffer2 == 4) {
lc.setRow(2, 0, c2_4[0]);
lc.setRow(2, 1, c2_4[1]);
lc.setRow(2, 2, c2_4[2]);
lc.setRow(2, 3, c2_4[3]);
lc.setRow(2, 4, c2_4[4]);
lc.setRow(2, 5, c2_4[5]);
lc.setRow(2, 6, c2_4[6]);
lc.setRow(2, 7, c2_4[7]);
}
if (ziffer2 == 5) {
lc.setRow(2, 0, c2_5[0]);
lc.setRow(2, 1, c2_5[1]);
lc.setRow(2, 2, c2_5[2]);
lc.setRow(2, 3, c2_5[3]);
lc.setRow(2, 4, c2_5[4]);
lc.setRow(2, 5, c2_5[5]);
lc.setRow(2, 6, c2_5[6]);
lc.setRow(2, 7, c2_5[7]);
}
if (ziffer2 == 6) {
lc.setRow(2, 0, c2_6[0]);
lc.setRow(2, 1, c2_6[1]);
lc.setRow(2, 2, c2_6[2]);
lc.setRow(2, 3, c2_6[3]);
lc.setRow(2, 4, c2_6[4]);
lc.setRow(2, 5, c2_6[5]);
lc.setRow(2, 6, c2_6[6]);
lc.setRow(2, 7, c2_6[7]);
}
if (ziffer2 == 7) {
lc.setRow(2, 0, c2_7[0]);
lc.setRow(2, 1, c2_7[1]);
lc.setRow(2, 2, c2_7[2]);
lc.setRow(2, 3, c2_7[3]);
lc.setRow(2, 4, c2_7[4]);
lc.setRow(2, 5, c2_7[5]);
lc.setRow(2, 6, c2_7[6]);
lc.setRow(2, 7, c2_7[7]);
}
if (ziffer2 == 8) {
lc.setRow(2, 0, c2_8[0]);
lc.setRow(2, 1, c2_8[1]);
lc.setRow(2, 2, c2_8[2]);
lc.setRow(2, 3, c2_8[3]);
lc.setRow(2, 4, c2_8[4]);
lc.setRow(2, 5, c2_8[5]);
lc.setRow(2, 6, c2_8[6]);
lc.setRow(2, 7, c2_8[7]);
}
if (ziffer2 == 9) {
lc.setRow(2, 0, c2_9[0]);
lc.setRow(2, 1, c2_9[1]);
lc.setRow(2, 2, c2_9[2]);
lc.setRow(2, 3, c2_9[3]);
lc.setRow(2, 4, c2_9[4]);
lc.setRow(2, 5, c2_9[5]);
lc.setRow(2, 6, c2_9[6]);
lc.setRow(2, 7, c2_9[7]);
}
if (ziffer3 == 0) {
lc.setRow(3, 0, c3_0[0]);
lc.setRow(3, 1, c3_0[1]);
lc.setRow(3, 2, c3_0[2]);
lc.setRow(3, 3, c3_0[3]);
lc.setRow(3, 4, c3_0[4]);
lc.setRow(3, 5, c3_0[5]);
lc.setRow(3, 6, c3_0[6]);
lc.setRow(3, 7, c3_0[7]);
}
if (ziffer3 == 1) {
lc.setRow(3, 0, c3_1[0]);
lc.setRow(3, 1, c3_1[1]);
lc.setRow(3, 2, c3_1[2]);
lc.setRow(3, 3, c3_1[3]);
lc.setRow(3, 4, c3_1[4]);
lc.setRow(3, 5, c3_1[5]);
lc.setRow(3, 6, c3_1[6]);
lc.setRow(3, 7, c3_1[7]);
}
if (ziffer3 == 2) {
lc.setRow(3, 0, c3_2[0]);
lc.setRow(3, 1, c3_2[1]);
lc.setRow(3, 2, c3_2[2]);
lc.setRow(3, 3, c3_2[3]);
lc.setRow(3, 4, c3_2[4]);
lc.setRow(3, 5, c3_2[5]);
lc.setRow(3, 6, c3_2[6]);
lc.setRow(3, 7, c3_2[7]);
}
if (ziffer3 == 3) {
lc.setRow(3, 0, c3_3[0]);
lc.setRow(3, 1, c3_3[1]);
lc.setRow(3, 2, c3_3[2]);
lc.setRow(3, 3, c3_3[3]);
lc.setRow(3, 4, c3_3[4]);
lc.setRow(3, 5, c3_3[5]);
lc.setRow(3, 6, c3_3[6]);
lc.setRow(3, 7, c3_3[7]);
}
if (ziffer3 == 4) {
lc.setRow(3, 0, c3_4[0]);
lc.setRow(3, 1, c3_4[1]);
lc.setRow(3, 2, c3_4[2]);
lc.setRow(3, 3, c3_4[3]);
lc.setRow(3, 4, c3_4[4]);
lc.setRow(3, 5, c3_4[5]);
lc.setRow(3, 6, c3_4[6]);
lc.setRow(3, 7, c3_4[7]);
}
if (ziffer3 == 5) {
lc.setRow(3, 0, c3_5[0]);
lc.setRow(3, 1, c3_5[1]);
lc.setRow(3, 2, c3_5[2]);
lc.setRow(3, 3, c3_5[3]);
lc.setRow(3, 4, c3_5[4]);
lc.setRow(3, 5, c3_5[5]);
lc.setRow(3, 6, c3_5[6]);
lc.setRow(3, 7, c3_5[7]);
}
if (ziffer3 == 6) {
lc.setRow(3, 0, c3_6[0]);
lc.setRow(3, 1, c3_6[1]);
lc.setRow(3, 2, c3_6[2]);
lc.setRow(3, 3, c3_6[3]);
lc.setRow(3, 4, c3_6[4]);
lc.setRow(3, 5, c3_6[5]);
lc.setRow(3, 6, c3_6[6]);
lc.setRow(3, 7, c3_6[7]);
}
if (ziffer3 == 7) {
lc.setRow(3, 0, c3_7[0]);
lc.setRow(3, 1, c3_7[1]);
lc.setRow(3, 2, c3_7[2]);
lc.setRow(3, 3, c3_7[3]);
lc.setRow(3, 4, c3_7[4]);
lc.setRow(3, 5, c3_7[5]);
lc.setRow(3, 6, c3_7[6]);
lc.setRow(3, 7, c3_7[7]);
}
if (ziffer3 == 8) {
lc.setRow(3, 0, c3_8[0]);
lc.setRow(3, 1, c3_8[1]);
lc.setRow(3, 2, c3_8[2]);
lc.setRow(3, 3, c3_8[3]);
lc.setRow(3, 4, c3_8[4]);
lc.setRow(3, 5, c3_8[5]);
lc.setRow(3, 6, c3_8[6]);
lc.setRow(3, 7, c3_8[7]);
}
if (ziffer3 == 9) {
lc.setRow(3, 0, c3_9[0]);
lc.setRow(3, 1, c3_9[1]);
lc.setRow(3, 2, c3_9[2]);
lc.setRow(3, 3, c3_9[3]);
lc.setRow(3, 4, c3_9[4]);
lc.setRow(3, 5, c3_9[5]);
lc.setRow(3, 6, c3_9[6]);
lc.setRow(3, 7, c3_9[7]);
}
}
void setMonth() {
DateTime now = rtc.now();
//Jan
if (now.month() == 1) {
lc.setRow(1, 0, m010[0]);
lc.setRow(1, 1, m010[1]);
lc.setRow(1, 2, m010[2]);
lc.setRow(1, 3, m010[3]);
lc.setRow(1, 4, m010[4]);
lc.setRow(1, 5, m010[5]);
lc.setRow(1, 6, m010[6]);
lc.setRow(1, 7, m010[7]);
lc.setRow(0, 0, m011[0]);
lc.setRow(0, 1, m011[1]);
lc.setRow(0, 2, m011[2]);
lc.setRow(0, 3, m011[3]);
lc.setRow(0, 4, m011[4]);
lc.setRow(0, 5, m011[5]);
lc.setRow(0, 6, m011[6]);
lc.setRow(0, 7, m011[7]);
}
//Feb
if (now.month() == 2) {
lc.setRow(1, 0, m020[0]);
lc.setRow(1, 1, m020[1]);
lc.setRow(1, 2, m020[2]);
lc.setRow(1, 3, m020[3]);
lc.setRow(1, 4, m020[4]);
lc.setRow(1, 5, m020[5]);
lc.setRow(1, 6, m020[6]);
lc.setRow(1, 7, m020[7]);
lc.setRow(0, 0, m021[0]);
lc.setRow(0, 1, m021[1]);
lc.setRow(0, 2, m021[2]);
lc.setRow(0, 3, m021[3]);
lc.setRow(0, 4, m021[4]);
lc.setRow(0, 5, m021[5]);
lc.setRow(0, 6, m021[6]);
lc.setRow(0, 7, m021[7]);
}
//Mr
if (now.month() == 3) {
lc.setRow(1, 0, m030[0]);
lc.setRow(1, 1, m030[1]);
lc.setRow(1, 2, m030[2]);
lc.setRow(1, 3, m030[3]);
lc.setRow(1, 4, m030[4]);
lc.setRow(1, 5, m030[5]);
lc.setRow(1, 6, m030[6]);
lc.setRow(1, 7, m030[7]);
lc.setRow(0, 0, m031[0]);
lc.setRow(0, 1, m031[1]);
lc.setRow(0, 2, m031[2]);
lc.setRow(0, 3, m031[3]);
lc.setRow(0, 4, m031[4]);
lc.setRow(0, 5, m031[5]);
lc.setRow(0, 6, m031[6]);
lc.setRow(0, 7, m031[7]);
}
//Apr
if (now.month() == 4) {
lc.setRow(1, 0, m040[0]);
lc.setRow(1, 1, m040[1]);
lc.setRow(1, 2, m040[2]);
lc.setRow(1, 3, m040[3]);
lc.setRow(1, 4, m040[4]);
lc.setRow(1, 5, m040[5]);
lc.setRow(1, 6, m040[6]);
lc.setRow(1, 7, m040[7]);
lc.setRow(0, 0, m041[0]);
lc.setRow(0, 1, m041[1]);
lc.setRow(0, 2, m041[2]);
lc.setRow(0, 3, m041[3]);
lc.setRow(0, 4, m041[4]);
lc.setRow(0, 5, m041[5]);
lc.setRow(0, 6, m041[6]);
lc.setRow(0, 7, m041[7]);
}
//Mai
if (now.month() == 5) {
lc.setRow(1, 0, m050[0]);
lc.setRow(1, 1, m050[1]);
lc.setRow(1, 2, m050[2]);
lc.setRow(1, 3, m050[3]);
...
This file has been truncated, please download it to see its full contents.
Comments