yuki hashimoto
/
Ticker
タイマー割り込み_周期
LED1とLED2を別々の周期で点滅
https://mbed.org/users/okini3939/notebook/Ticker_jp/
main.cpp
- Committer:
- hasimo
- Date:
- 2014-07-23
- Revision:
- 0:cc2191a97feb
File content as of revision 0:cc2191a97feb:
#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); } }