Uses two tickers to create square wave outputs to the LED's
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:b2e9baae81b3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Feb 17 11:44:05 2015 +0000 @@ -0,0 +1,29 @@ +#include "mbed.h" + +Ticker flipper1; +Ticker flipper2; +DigitalOut myLED(LED1); +DigitalOut myLED2(LED2); + +void flip1() +{ + myLED = !myLED; +} + +void flip2() +{ + myLED2 = !myLED2; +} + +int main() +{ + myLED = 0; + myLED2 = 0; + flipper1.attach(&flip1, 0.2); + flipper2.attach(&flip2, 1.0); + + while(1) + { + wait(0.2); + } +} \ No newline at end of file