Ticker
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:c25c01018413
diff -r 000000000000 -r c25c01018413 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Nov 06 12:42:56 2016 +0000 @@ -0,0 +1,17 @@ + /* Program Example 8: 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”//TIC TIC TIC TIC cosa riipetuta in un loop + DigitalOut myled(D3); + void led_switch() //the function that Ticker will call + { + myled=!myled; + } + int main() + { + time_up.attach(&led_switch, 0.5); //initializes the ticker + while(1) { //sit in a loop doing nothing, waiting for Ticker interrupt + } +} \ No newline at end of file