Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 6 months ago.
Nucleo_display_time example doesn't work in while loop.
Dear All,
On NUCLEO-F401RE board, I am trying to test Nucleo_display_time example code however it works one time only. It doesn't work in while loop. So I did remove Wait(1) for testing and it works. Please, review for this issue. Thanks.
include the mbed library with this snippet
#include "mbed.h" DigitalOut myled(LED1); int main() { printf("RTC example\n"); set_time(1387188323); // Set RTC time to 16 December 2013 10:05:23 UTC printf("Date and time are set.\n"); while(1) { time_t seconds = time(NULL); //printf("Time as seconds since January 1, 1970 = %d\n", seconds); printf("Time as a basic string = %s", ctime(&seconds)); //char buffer[32]; //strftime(buffer, 32, "%I:%M:%S %p\n", localtime(&seconds)); //printf("Time as a custom formatted string = %s", buffer); myled = !myled; wait(1); } }
wait(1); doesn't work. has to be modified to wait_ms(1000);
posted by Gideon Hyun 12 May 2015I tried same program and works well without modification (with wait(1);).
posted by Kenji Arai 12 May 2015Please check External Xtal.
You can check with following my program.
/users/kenjiArai/code/SetRTC/
/users/kenjiArai/notebook/nucleo-series-rtc-control-under-power-onoff-and-re/
Hi Kenji, I just saw it. Thanks for your help... Good day~
posted by Gideon Hyun 13 Jul 2015