Test de RTC_IUT

Dependencies:   RTC_IUT

main.cpp

Committer:
gr91
Date:
2020-05-30
Revision:
1:92f65ad2bb0a
Parent:
0:8a5436c20b46

File content as of revision 1:92f65ad2bb0a:

#include "mbed.h"
#include "RTC_IUT.h"
Rtc rtc;
///
int main()
{
    //char TimeTest[] = "31/12/1999 23:59:50";
    //char TimeTest[] = "19/01/2038 03:13:50";
    char TimeTest[] = "03/06/1970 10:00:00";
    time_t epoc;
    char buf[50];
    rtc.SetTimeString(TimeTest);
    rtc.GetTimeString(buf);
    epoc =rtc.GetTimeValue();
    printf("epoc: %8X, time: %s\r\n", epoc, buf);
    while(1) {
        rtc.SetYear(2020);   // Set the year
        rtc.GetTimeString(buf);  // read date time string DD:MM:YYY hh:mm:ss
        epoc =rtc.GetTimeValue();  // Read second since 01/01/1970
        printf("epoc: %8X, time: %s\r\n", epoc, buf);
        wait(0.9999);
    }
}