#include <Adafruit_NeoPixel.h>
#include <Wire.h>
#include <I2C_RTC.h>
#define stripH1 5
#define stripH0 6
#define stripM1 7
#define stripM0 8
#define RED 0xFFFF0000
#define YELLOW 0xFFFFFF00
static DS1307 RTC;
Adafruit_NeoPixel h1(4, stripH1);
Adafruit_NeoPixel h0(4, stripH0);
Adafruit_NeoPixel m1(11, stripM1);
Adafruit_NeoPixel m0(4, stripM0);
void setup() {
pinMode(stripH1, OUTPUT);
pinMode(stripH0, OUTPUT);
pinMode(stripM1, OUTPUT);
pinMode(stripM0, OUTPUT);
Wire.begin();
RTC.begin();
h1.begin();
h0.begin();
m1.begin();
m0.begin();
}
void loop() {
h1.clear();
h0.clear();
m1.clear();
m0.clear();
byte hours = RTC.getHours();
byte minutes = RTC.getMinutes();
byte anzahlH1 = hours/5;
byte anzahlH0 = hours%5;
byte anzahlM1 = minutes/5;
byte anzahlM0 = minutes%5;
anzeigen(anzahlH1, anzahlH0, anzahlM1, anzahlM0);
}
void anzeigen(byte anzahlH1, byte anzahlH0, byte anzahlM1, byte anzahlM0){
h1.fill(RED, 0, anzahlH1);
h0.fill(RED, 0, anzahlH0);
m1.fill(YELLOW, 0, anzahlM1); //(farbe, startpixel, anzahl der zu färbenden Pixel)
m0.fill(RED, 0, anzahlM0);
if (anzahlM1>=3){
m1.setPixelColor(2, RED); //(pixel, farbe)
}
if (anzahlM1>=6){
m1.setPixelColor(5, RED);
}
if (anzahlM1>=9){
m1.setPixelColor(8, RED);
}
h1.show();
h0.show();
m1.show();
m0.show();
}