A found something what looks like a bug, but maybe i'm missing something.
Could somebody please look to the code and tell me why my attached functions are never fired?
#include "mbed.h"
#include "TextLCD.h"
#include "EthernetNetIf.h"
#include "NTPClient.h"
Ticker NTPTimer, RTCTimer;
EthernetNetIf eth;
NTPClient ntp;
DigitalOut myled1(LED1), myled4(LED4);
TextLCD lcd(p24, p25, p26, p27, p28, p29, TextLCD::LCD20x2); // rs, e, d0, d1, d2, d3
time_t epoch;
uint32_t timediff = (60*60*2);
void RTCThick() {
myled1 = !myled1;
lcd.cls();
epoch = time(NULL) + timediff;
lcd.printf("Current time is: %s", ctime(&epoch));
}
void NtpThick() {
Host ntpserver(IpAddr(), 123, "time.xs4all.nl");
ntp.setTime(ntpserver);
}
int main() {
wait(1);
lcd.cls();
lcd.printf("MBED Started");
eth.setup();
NtpThick();
RTCThick();
NTPTimer.attach(&NtpThick, (60*60*6));
RTCTimer.attach(&RTCThick, 1);
while (1) {
wait(1);
myled4 = !myled4;
}
}
RTCThick should be invoked every second. But led1 never blinks (goes to on due to RTCThick() in the main and stays on).
I also added a while (1) loop, with a change on led4 as could imagine that I was'nt creating enough IRQs.
Thankx in advance.
A found something what looks like a bug, but maybe i'm missing something.
Could somebody please look to the code and tell me why my attached functions are never fired?
RTCThick should be invoked every second. But led1 never blinks (goes to on due to RTCThick() in the main and stays on).
I also added a while (1) loop, with a change on led4 as could imagine that I was'nt creating enough IRQs.
Thankx in advance.