Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include <Sodaq_DS3231.h>
- #include <TM1637Display.h>
- #include <Arduino.h>
- #define CLK 3
- #define DIO 2
- TM1637Display display(CLK, DIO);
- // yyyy, mm, dd, hh, mm, ss, dd
- //DateTime dt(2017, 10, 30, 17, 20, 30, 0);
- DateTime now;
- const uint8_t SEG_8421[] = {
- SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F | SEG_G, // 8
- SEG_F | SEG_G | SEG_B | SEG_C, // 4
- SEG_A | SEG_B | SEG_G | SEG_E | SEG_D, // 2
- SEG_B | SEG_C // 1
- };
- void setup() {
- Wire.begin();
- rtc.begin();
- // rtc.setDateTime(dt);
- display.setBrightness(0x09);
- display.setSegments(SEG_8421);
- delay(1000);
- }
- uint32_t old_TimeStamp;
- void loop() {
- DateTime now = rtc.now();
- for(int i = 0; i < 14; i++){
- display.showNumberDec(now.hour() * 100 + now.minute(), true, 4, 0);
- delay(500);
- }
- for(int j = 0; j < 2; j++){
- display.showNumberDec(now.second(), false, 4, 0);
- delay(500);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment