This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | Last revision Both sides next revision | ||
|
oak:tutorials:button [2016/03/20 05:11] djflix Added example of interrupts |
oak:tutorials:button [2016/03/20 05:12] djflix |
||
|---|---|---|---|
| Line 42: | Line 42: | ||
| void good_handleButtonPress() { | void good_handleButtonPress() { | ||
| - | event_has_happened = true; //set a bool to true so we can handle it in loop() | + | //set a bool to true so we can handle it in loop() |
| + | event_has_happened = true; | ||
| } | } | ||
| void bad_handleButtonPress() { | void bad_handleButtonPress() { | ||
| - | delay(500); // wait user to release button | + | // wait user to release button |
| - | call_another_slow_function(); //Handle the button press now so we won't forget it happened! | + | delay(500); |
| + | //Handle the button press now so we won't forget it happened! | ||
| + | call_another_slow_function(); | ||
| } | } | ||
| </code> | </code> | ||