Hello World for Ticker
mbed 2 and mbed OS 5
This is an mbed 2 example. For an mbed-os example, please see:
Import programTicker_HelloWorld
Hello World for Ticker
main.cpp
- Committer:
- mbed_official
- Date:
- 2013-02-14
- Revision:
- 0:5014bf742e9b
File content as of revision 0:5014bf742e9b:
#include "mbed.h" Ticker flipper; DigitalOut led1(LED1); DigitalOut led2(LED2); void flip() { led2 = !led2; } int main() { led2 = 1; flipper.attach(&flip, 2.0); // the address of the function to be attached (flip) and the interval (2 seconds) // spin in a main loop. flipper will interrupt it to call flip while(1) { led1 = !led1; wait(0.2); } }