Use local bugfixed Rtc_Pcf8563 library
All checks were successful
Compile / Compile (push) Successful in 4m27s
All checks were successful
Compile / Compile (push) Successful in 4m27s
This commit is contained in:
parent
6b1c04e1de
commit
29fa5486cb
9 changed files with 1378 additions and 1 deletions
52
lib/Rtc_Pcf8563/examples/set_clock/set_clock.pde
Normal file
52
lib/Rtc_Pcf8563/examples/set_clock/set_clock.pde
Normal file
|
@ -0,0 +1,52 @@
|
|||
/* Demonstration of Rtc_Pcf8563 Set Time.
|
||||
* Set the clock to a time then loop over reading time and
|
||||
* output the time and date to the serial console.
|
||||
*
|
||||
* I used a RBBB with Arduino IDE, the pins are mapped a
|
||||
* bit differently. Change for your hw
|
||||
* SCK - A5, SDA - A4, INT - D3/INT1
|
||||
*
|
||||
* After loading and starting the sketch, use the serial monitor
|
||||
* to see the clock output.
|
||||
*
|
||||
* setup: see Pcf8563 data sheet.
|
||||
* 1x 10Kohm pullup on Pin3 INT
|
||||
* No pullups on Pin5 or Pin6 (I2C internals used)
|
||||
* 1x 0.1pf on power
|
||||
* 1x 32khz chrystal
|
||||
*
|
||||
* Joe Robertson, jmr
|
||||
* orbitalair@bellsouth.net
|
||||
*/
|
||||
#include <Wire.h>
|
||||
#include <Rtc_Pcf8563.h>
|
||||
|
||||
//init the real time clock
|
||||
Rtc_Pcf8563 rtc;
|
||||
|
||||
void setup()
|
||||
{
|
||||
//clear out the registers
|
||||
rtc.initClock();
|
||||
//set a time to start with.
|
||||
//day, weekday, month, century(1=1900, 0=2000), year(0-99)
|
||||
rtc.setDate(14, 6, 3, 1, 10);
|
||||
//hr, min, sec
|
||||
rtc.setTime(1, 15, 0);
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
//both format functions call the internal getTime() so that the
|
||||
//formatted strings are at the current time/date.
|
||||
Serial.print(rtc.formatTime());
|
||||
Serial.print("\r\n");
|
||||
Serial.print(rtc.formatDate());
|
||||
Serial.print("\r\n");
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue