rter

Dependencies:   BluetoothSerial SeeedShieldBot mbed

Revision:
0:bf723d62720d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 12 09:06:01 2015 +0000
@@ -0,0 +1,52 @@
+#include "mbed.h"
+
+BusOut Leds (PA_9,PC_7,PB_6,PA_5,PB_5,PB_4);
+InterruptIn SW7 (PB_3);
+InterruptIn SW4 (PC_1);
+
+static int teller=0;
+
+void SW7_Pushed()
+{ teller=teller+1;
+  //Leds=~teller;
+}
+
+int main()
+{
+    //Leds=~teller;
+    SW7.fall(&SW7_Pushed);
+    wait_ms(5);
+    
+    while (true)
+    {
+        SW4==1;
+        
+        teller=0;
+        SW7.enable_irq();
+        wait_ms(1000);
+        SW7.disable_irq();
+        
+        if (teller >= 8)
+            Leds=~0xFF;
+        else if (teller >= 7)
+            Leds=~0x7F;
+        else if (teller >= 6)
+            Leds=~0x3F;
+        else if (teller >= 5)
+            Leds=~0x1F;
+        else if (teller >= 4)
+            Leds=~0x0F;
+        else if (teller >= 3)
+            Leds=~0x07;
+        else if (teller >= 2)
+            Leds=~0x03;
+        else if (teller >= 1)
+            Leds=~0x01;
+        else Leds=~0x00;
+            
+        
+        
+    }
+}     
+          
+