Because the light of four LED flows, the button is stopped pushing and seen at the decided position. Do you make it to good?

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
airwhite
Date:
Fri Oct 15 14:45:14 2010 +0000
Commit message:

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 1d5cfa0bead6 main.cpp
--- /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);
+    }
+}
diff -r 000000000000 -r 1d5cfa0bead6 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Oct 15 14:45:14 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e