![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Grove Starter Kit for mbed - Button
Diff: main.cpp
- Revision:
- 1:f93ac9d8770c
- Parent:
- 0:c48d7e51d9c9
--- a/main.cpp Mon Feb 16 10:59:24 2015 +0000 +++ b/main.cpp Tue Feb 24 13:45:20 2015 +0000 @@ -1,16 +1,17 @@ #include "mbed.h" -DigitalOut myled(LED1); +DigitalOut led(LED1); DigitalIn button(p21); -int main() { +int main() +{ while(1) { + wait(0.1); if (button) { - myled = 1; + led = 1; + } else { + led = 0; } - else - myled = 0; - - wait(0.7); // simple debouncing + wait(0.4); // simple debouncing } -} \ No newline at end of file +}