[Time] RX8025 Real-Time Clock Library

Download Download: RX8025.zip

Example code

This code is also already included in the .zip file
  1. #include <wire.h>
  2. #include <rx8025.h>
  3. void setup()
  4. {
  5.   Serial.begin(9600);
  6.   RX8025.init();
  7. }
  8. void loop()
  9. {
  10.   int rtc_sec, rtc_min, rtc_hou, rtc_wee, rtc_dat, rtc_mon, rtc_yea;
  11.   delay(1000); // There will be new values every 100ms
  12.   RX8025.getRtcTime(&rtc_sec, &rtc_min, &rtc_hou, &rtc_wee, &rtc_dat, &rtc_mon, &rtc_yea);
  13.   Serial.print(rtc_dat,DEC);
  14.   Serial.print("/");
  15.   Serial.print(rtc_mon,DEC);
  16.   Serial.print("/");
  17.   Serial.print(rtc_yea,DEC);
  18.   Serial.print(" ");
  19.   Serial.print(rtc_wee,DEC);
  20.   Serial.print(" ");
  21.   Serial.print(rtc_hou,DEC);
  22.   Serial.print(":");
  23.   Serial.print(rtc_min,DEC);
  24.   Serial.print(":");
  25.   Serial.println(rtc_sec,DEC);
  26. }
  1. //First define this
  2. unsigned char RX8025_time[7]={0x00,0x52,0x13,0x01,0x11,0x04,0x11 //second, minute, hour, week, date, month, year, BCD format};
  3. //Then call this
  4. RX8025.setRtcTime(RX8025_time);
]]>

You may also like...

1 Response

  1. Ed says:

    Hi,
    The line of code that says: unsigned char RX8025_time[7]={0x00,0x52,0x13,0x01,0x11,0x04,0x11 //second, minute, hour, week, date, month, year, BCD format};
    …comments out the last curly bracket and semi-colon.
    Cheers,
    Ed