#include <SevenSeg.h>
#include "RTClib.h"
RTC_DS1307 rtc;
SevenSeg disp(2,3,4,5,6,7,8);
SevenSeg disp1(2,3,4,5,6,7,8);
const int numOfDigits=4;
int digitPins[numOfDigits]={ 13,12,11,10};
int digitPins1[2]={A0, A1};
void setup() {
disp.setDigitPins(numOfDigits, digitPins);
disp1.setDigitPins(2, digitPins1);
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
Serial.flush();
while (1) delay(10);
}
if (! rtc.isrunning()) {
Serial.println("RTC is NOT running, let's set the time!");
// When time needs to be set on a new device, or after a power loss, the
// 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
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}
}
void loop() {
DateTime now = rtc.now();
float jam = (now.hour()*100)+now.minute();
disp.writeClock(now.minute(),now.second());
disp.clearDisp();
disp1.writeClock(now.hour());
disp1.clearDisp();
}