QT Chan
/
Nucleo_read_button
Button control led blink
Diff: main.cpp
- Revision:
- 1:03f6bcfaacf8
- Parent:
- 0:c9d8fcdda4d0
--- a/main.cpp Fri Feb 21 12:57:03 2014 +0000 +++ b/main.cpp Sun Jul 03 15:07:34 2016 +0000 @@ -7,7 +7,13 @@ while(1) { if (mybutton == 0) { // Button is pressed myled = !myled; // Toggle the LED state - wait(0.2); // 200 ms + wait(0.1); // 100 ms + } + else { + myled = 1; // LED is ON + wait(0.2); // 200 ms + myled = 0; // LED is OFF + wait(1.0); // 1 sec } } }