Because the light of four LED flows, the button is stopped pushing and seen at the decided position. Do you make it to good?
Diff: main.cpp
- Revision:
- 0:1d5cfa0bead6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Oct 15 14:45:14 2010 +0000 @@ -0,0 +1,32 @@ +/* + Name: Roulette + Function: IntteruptIn, BusOut + Parts: Push Button +*/ + +#include "mbed.h" + +InterruptIn button(p5); // Push Button +BusOut myleds(LED1, LED2, LED3, LED4); +int save; + +void blink() { + save = myleds; + myleds = 0; wait(0.3); + myleds = save; wait(0.3); + myleds = 0; wait(0.3); + myleds = save; wait(0.3); + myleds = 0; wait(0.3); + myleds = save; wait(0.3); + myleds = 0; wait(3); +} + +int main() { + button.rise(&blink); + while(true) { + myleds = 1; wait(0.1); + myleds = 2; wait(0.1); + myleds = 4; wait(0.1); + myleds = 8; wait(0.1); + } +}