Gerardo Carmona
/
info_ticker
Diff: main.cpp
- Revision:
- 0:54430c87a6e3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri May 09 15:36:11 2014 +0000 @@ -0,0 +1,37 @@ +#include "mbed.h" + +Ticker toggle_led2; +Ticker toggle_led3; +DigitalOut led1(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); + +void t_led2(); +void t_led3(); + + +int main() { + led2 = 1; + toggle_led2.attach(&t_led2, 1.0); // the address of the function to be attached and the interval (2 seconds) + toggle_led3.attach(&t_led3, 0.4); + + while(1) { + led1 = !led1; + wait(0.2); + } +} + +void t_led2(){ + led2 = !led2; +} + +void t_led3(){ + led3 = !led3; +} + + + + + + +