Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <RTClib.h>
- #include <Adafruit_NeoPixel.h>
- #include <Wire.h>
- #define NEOPIN 3
- #define BRIGHTNESS 25
- char second1, minute1, hour1;
- RTC_DS1307 RTC;
- DateTime theTime;
- Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, NEOPIN, NEO_GRB + NEO_KHZ800);
- void setup() {
- //Zegarek
- Serial.begin(9600);
- Wire.begin();
- RTC.begin();
- RTC.adjust(DateTime(__DATE__, __TIME__));
- DateTime now = RTC.now();
- RTC.adjust(now);
- //Wyświetlacz
- strip.begin();
- strip.setBrightness(BRIGHTNESS);
- }
- void loop() {
- //Zegarek
- DateTime now = RTC.now();
- Serial.print(now.day(), DEC);
- Serial.print('.');
- Serial.print(now.month(), DEC);
- Serial.print('.');
- Serial.print(now.year(), DEC);
- Serial.print(' ');
- Serial.print(now.hour(), DEC);
- Serial.print(':');
- Serial.print(now.minute(), DEC);
- Serial.print(':');
- Serial.print(now.second(), DEC);
- Serial.println();
- delay(1000);
- //Pobiera dane z zegara
- second1 = now.second();
- minute1 = now.minute();
- hour1 = now.hour();
- //Wyświetlacz
- strip.setPixelColor(second1, 255, 0, 0);
- strip.setPixelColor(minute1, 0, 255, 0);
- strip.show();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement