@@ -6,7 +6,7 @@ RTC_PCF8563 rtc;
66char daysOfTheWeek[7 ][12 ] = {" Sunday" , " Monday" , " Tuesday" , " Wednesday" , " Thursday" , " Friday" , " Saturday" };
77
88// use D2 for INT0; attach to CLKOUT pin on RTC
9- const uint8_t INT_PIN = 2 ;
9+ const uint8_t INT_PIN = 2 ;
1010
1111// flag to update serial; set in interrupt callback
1212volatile uint8_t tick_tock = 1 ;
@@ -23,7 +23,7 @@ void setup () {
2323 while (!Serial); // wait for serial port to connect. Needed for native USB
2424#endif
2525
26-
26+
2727 pinMode (INT_PIN, INPUT); // set up interrupt pin
2828 digitalWrite (INT_PIN, HIGH); // turn on pullup resistors
2929 // attach interrupt to set_tick_tock callback on rising edge of INT0
@@ -32,7 +32,7 @@ void setup () {
3232 if (! rtc.begin ()) {
3333 Serial.println (" Couldn't find RTC" );
3434 Serial.flush ();
35- abort ( );
35+ while ( 1 ) delay ( 10 );
3636 }
3737
3838 if (rtc.lostPower ()) {
@@ -51,7 +51,7 @@ void setup () {
5151 }
5252
5353
54-
54+
5555 // When time needs to be re-set on a previously configured device, the
5656 // following line sets the RTC to the date & time this sketch was compiled
5757 // rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
@@ -63,7 +63,7 @@ void setup () {
6363 // to be restarted by clearing the STOP bit. Let's do this to ensure
6464 // the RTC is running.
6565 rtc.start ();
66-
66+
6767 // turn on 1Hz clock out, used as INT0 for serial update every second
6868 rtc.writeSqwPinMode (PCF8563_SquareWave1Hz);
6969}
@@ -72,7 +72,7 @@ void loop () {
7272
7373 // check if time display should be output
7474 if (tick_tock) {
75-
75+
7676 DateTime now = rtc.now ();
7777
7878 char time_format[] = " hh:mm:ss AP" ;
@@ -81,7 +81,7 @@ void loop () {
8181 Serial.println (now.toString (time_format));
8282 Serial.println (now.toString (date_format));
8383 Serial.println ();
84-
84+
8585 tick_tock = 0 ;
8686
8787 }
0 commit comments