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.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
I use this code a few times ago, to set the Real Time Clock with/from the mbed. It works well. But now I want to use it again and suddenly the time was set on 11:39, Wed, 28/10/2009 I don't know. What can I do to use the real time from mbed. Now it's 9:44, 11/09/2012. Please give me a code example. :)
That's the code:
#include "mbed.h" #include "TextLCD.h" TextLCD lcd(p26, p25, p24, p23, p22, p20, p19, TextLCD::LCD20x4); Serial pc(USBTX,USBRX); Ticker rhythm; void myrhythm() { } int main() { while(1) { time_t seconds = time(NULL); void set_time(time_t t); char buffer[32]; strftime(buffer, 32, "%H:%M:%S\n%a, %d/%m/%Y", localtime(&seconds)); lcd.locate(0,0); lcd.printf("%s", buffer); lcd.locate(0,2); lcd.printf("BBR Verkehrstechnik\nFranziska Gerlich"); rhythm.attach (&myrhythm, 1.0); } }