El-POM1001 / Mbed 2 deprecated LAB03_Oppgave1

Dependencies:   mbed

Revision:
1:b9d180275f1a
Parent:
0:a7fe10523b91
--- a/main.cpp	Thu Sep 10 08:30:45 2015 +0000
+++ b/main.cpp	Thu Sep 10 08:59:17 2015 +0000
@@ -3,16 +3,20 @@
 BusOut Leds(PA_9,PC_7,PB_6,PA_7,PA_6,PA_5,PB_5,PB_4);
 InterruptIn SW7(PB_3);
 
+//Variables
 Timer timer1;
+static int teller = 0;
 
-static int teller = 0;
+//Prototypes
+void SetLeds();
+
 
 void SW7_Pushed()
 {
-    teller++;    
-    
+    teller++;      
 }
 
+
 int main() 
 {
     
@@ -21,13 +25,28 @@
     while (true) 
     {
         timer1.start();
-        if(timer1.read_ms() == 500)
+        if(timer1.read_ms() == 1000)
         {
             timer1.stop();
             timer1.reset();
-            Leds = ~teller;
+            SetLeds();
             teller = 0;
         }
-      
     }
+}
+
+void SetLeds()
+{
+    if(teller == 0) Leds = ~0;    
+    if(teller == 1) Leds = 0xFF & 0xFE;
+    if(teller == 2) Leds = 0xFF & 0xFD;
+    if(teller == 3) Leds = 0xFF & 0xFC;
+    if(teller == 4) Leds = 0xFF & 0xFB;
+    if(teller == 5) Leds = 0xFF & 0xFA;
+    if(teller == 6) Leds = 0xFF & 0xF9;
+    if(teller == 7) Leds = 0xFF & 0xF8;
+    if(teller == 8) Leds = 0xFF & 0xF7;
+   
+        
+
 }
\ No newline at end of file