Irma Jakić Tarik Demirović

Dependencies:   mbed

Revision:
0:d515d96c18e3
diff -r 000000000000 -r d515d96c18e3 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Mar 10 07:59:29 2014 +0000
@@ -0,0 +1,66 @@
+#include "mbed.h"
+
+BusOut leds(dp23, dp24, dp25, dp26, dp27, dp5, dp6, dp28);
+DigitalOut enable(dp14);
+DigitalIn taster1(dp1);
+DigitalIn taster2(dp2);
+
+bool pressed1()
+{
+    int j = 0;
+    while(taster1)
+    {
+        j++;
+        if(j > 1000)
+        {
+            return true;
+        }
+    }
+    j = 0;
+    return false;
+}
+
+bool pressed2()
+{
+    int j = 0;
+    while(taster2)
+    {
+        j++;
+        if(j > 1000)
+        {
+            return true;
+        }
+    }
+    j = 0;
+    return false;
+}
+
+int main() {
+    enable = 0;
+    leds = 0;
+    int i = 0;
+    while(1) {
+        if(pressed1())
+        {
+            if(i == 256)
+            {
+                i = 0;    
+            }
+            i++;
+            leds = i;
+            while(taster1){}
+            
+        }
+        if(pressed2())
+        {
+            if(i == 0)
+            {
+                i = 257;    
+            }
+            i--;
+            leds = i;
+            while(taster2) {}
+        }
+            
+    }
+}