#include <RTClib.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_GFX.h>
#include <Adafruit_NeoPixel.h>
#define dataPin 6
#define matrixWidth 16
#define matrixHeight 8
#define tilesX 1
#define tilesY 1
// RTC_DS3231 rtc;
RTC_DS1307 rtc;
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(matrixWidth, matrixHeight, tilesX, tilesY, dataPin,
NEO_TILE_TOP + NEO_TILE_LEFT + NEO_TILE_ROWS + NEO_TILE_PROGRESSIVE +
NEO_MATRIX_LEFT + NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,
NEO_GRB + NEO_KHZ800);
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
int Arduino [matrixWidth][matrixHeight] {}; // Main array 8x16
int Zahlen [][3] { //nummber storage arry 0-9
{1, 1, 1}, //0
{1, 0, 1},
{1, 0, 1},
{1, 0, 1},
{1, 1, 1},
{0, 0, 1}, //1
{0, 0, 1},
{0, 0, 1},
{0, 0, 1},
{0, 0, 1},
{1, 1, 1}, //2
{0, 0, 1},
{1, 1, 1},
{1, 0, 0},
{1, 1, 1},
{1, 1, 1}, //3
{0, 0, 1},
{1, 1, 1},
{0, 0, 1},
{1, 1, 1},
{1, 0, 1}, //4
{1, 0, 1},
{1, 1, 1},
{0, 0, 1},
{0, 0, 1},
{1, 1, 1}, //5
{1, 0, 0},
{1, 1, 1},
{0, 0, 1},
{1, 1, 1},
{1, 1, 1}, //6
{1, 0, 0},
{1, 1, 1},
{1, 0, 1},
{1, 1, 1},
{1, 1, 1}, //7
{0, 0, 1},
{0, 0, 1},
{0, 0, 1},
{0, 0, 1},
{1, 1, 1}, //8
{1, 0, 1},
{1, 1, 1},
{1, 0, 1},
{1, 1, 1},
{1, 1, 1}, //9
{1, 0, 1},
{1, 1, 1},
{0, 0, 1},
{1, 1, 1}
};
void setup () {
Serial.begin(9600);
if (!rtc.begin()) {
Serial.println("RTC not found!");
while (1);
}
// if (rtc.lostPower()) {
// Serial.println("RTC has no power");
// rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// }
matrix.begin();
matrix.setBrightness(20);
uint16_t numLEDs = matrix.numPixels();
Serial.println(numLEDs);
}
void loop () {
DateTime now = rtc.now(); // Holen der aktuellen Zeit
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(" ");
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
int einer_sec = now.second() % 10;
int zehner_sec = (now.second() / 10) % 10;
int einer_min = now.minute() % 10;
int zehner_min = (now.minute() / 10) % 10;
//byte einer_min = now.second() % 10;
//byte zehner_min = (now.second() / 10) % 10;
Serial.println(zehner_sec);
int Nummer[] = {zehner_min, einer_min, zehner_sec, einer_sec};
for (int Stelle = 0; Stelle < 4; Stelle++) {
for (int reihe = 0; reihe < 5; reihe++) {
for (int spalte = 0; spalte < 3; spalte++) {
Arduino[reihe][spalte + (4 * Stelle)] = Zahlen[reihe + (5 * Nummer[Stelle])][spalte];
}
}
}
Arduino[10][0] = 1;
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 8; y++) {
if (Arduino[x][y]) {
matrix.drawPixel(x, y, RED);
Serial.println(x);
}
}
Serial.println("loop");
}
Serial.println("End");
matrix.show();
}
nano:12
nano:11
nano:10
nano:9
nano:8
nano:7
nano:6
nano:5
nano:4
nano:3
nano:2
nano:GND.2
nano:RESET.2
nano:0
nano:1
nano:13
nano:3.3V
nano:AREF
nano:A0
nano:A1
nano:A2
nano:A3
nano:A4
nano:A5
nano:A6
nano:A7
nano:5V
nano:RESET
nano:GND.1
nano:VIN
nano:12.2
nano:5V.2
nano:13.2
nano:11.2
nano:RESET.3
nano:GND.3
neopixels1:DOUT
neopixels1:VDD
neopixels1:VSS
neopixels1:DIN
neopixels2:DOUT
neopixels2:VDD
neopixels2:VSS
neopixels2:DIN
rtc1:GND
rtc1:5V
rtc1:SDA
rtc1:SCL
rtc1:SQW