Juan Angel García
/
9_9
mbed ticker
main.cpp
- Committer:
- jangelgm
- Date:
- 2017-03-09
- Revision:
- 0:44154aa7dd24
File content as of revision 0:44154aa7dd24:
/* Program Example 9.9: Simple demo of "Ticker". Replicates behavior of first led flashing program. */ #include "mbed.h" void led_switch(void); Ticker time_up; //define a Ticker, with name “time_up” DigitalOut myled(LED1); void led_switch() //the function that Ticker will call { myled=!myled; } int main() { time_up.attach(&led_switch, 0.2); //initializes the ticker while(1) { //sit in a loop doing nothing, waiting for Ticker interrupt } }