Internal RTC Nucleo F767ZI Date Time Set and Print with Threads

Dependencies:   InternalRTC

main.cpp

Committer:
shivanandgowdakr
Date:
2019-09-16
Revision:
1:327e9488a197
Parent:
0:6ffa61b54883

File content as of revision 1:327e9488a197:

#include "mbed.h"
#include "RTC.h"

DigitalOut led1(LED1);
Thread Time;

  char Current_Time[15]={'\0'};
void Print_Date_Time(void)
{
    while(true)
    {
        Get_Date_Time(Current_Time);
        led1=!led1;
        printf("Date and Time is %s\r\n",Current_Time);
        wait(1);
    }  
}


int main() 
{
    
    printf("Am here\r\n");
    char Time_2_Set[40]= "28/02/2019 23:59:55";//{'\0'};
    
    
    if(iSetTerminalTime(Time_2_Set))
    {
        printf("Time Set Success\r\n");
    }
    Time.start(Print_Date_Time); 
    
}