通过按键控制LED
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:c3898039eff5
diff -r 000000000000 -r c3898039eff5 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Dec 05 03:27:57 2015 +0000 @@ -0,0 +1,19 @@ +#include "mbed.h" +DigitalOut led1(LED1); +DigitalIn btn(USER_BUTTON); +int main() +{ + led1=0; + while (1) { + if (btn==0 ) { + wait_ms(10); + if (btn==0 ) { + led1=!led1; + while (btn==0); + } + } + + } + + +}