-->
Page 1 of 2

timer callback example

PostPosted: Thu Apr 09, 2015 3:55 am
by KurtB
Hi,
can someone give me an example to callback timer for the Arduino IDE of ESP8266 ?
I tried the following one, but I'm not a C++ expert:

#include Ticker.h

void callback_set(void)
{
digitalWrite(0, 0);
}

void set_timer(void) {
Ticker tick;
tick.once_ms(1000, &callback_set);
}

set_timer();

The goal is to set GPIO 0 after 1 second.
Thanks
KurtB

Re: timer callback example

PostPosted: Thu Apr 09, 2015 4:04 am
by gerardwr
Did you have a look at the TickerBasic example that's provided?

Re: timer callback example

PostPosted: Thu Apr 09, 2015 4:36 am
by KurtB
Hi, didn't notice that example. Realy simple to use. Many thanks now it runs.
KurtB

Re: timer callback example

PostPosted: Thu Apr 09, 2015 4:40 am
by gerardwr
Have fun!