Pajić Enil Lejla Agić

Dependencies:   mbed

Revision:
0:03f37e705af1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Mar 10 09:05:17 2014 +0000
@@ -0,0 +1,41 @@
+#include "mbed.h"
+
+BusOut KOL(dp16, dp15, dp17, dp18);
+BusIn RED (dp9, dp10, dp11, dp13);
+BusOut l (dp23, dp24, dp25, dp26, dp27, dp5, dp6, dp28);
+DigitalOut e (dp14);
+int Dugme ()
+    {
+        int Z[] = {1, 2, 4, 8};
+        for (int a = 1; a < 5; ++a)
+            {
+                KOL = Z[a - 1];
+                for (int b = 1; b < 5; ++b)
+                    {
+                        if (RED == Z[b-1])
+                            return 1+ 4*(a-1) + (b-1);
+                    }
+                
+            }
+        return 0;
+    }
+int main() {
+    int Z[] = {127, 191, 223, 239, 247, 251, 253, 254};
+    e = 0;
+    l = 1;
+    e = 1;
+    int x = 0;
+    while(1) {
+        e = 1;
+        x = Dugme();
+        e = 0;
+        if (x > 0 && x < 13)
+        {
+            if (x >= 5 && x < 9) x--;
+            if (x >= 9) x -= 2;
+            
+            l = Z[x-1];
+        }
+        wait (0.5);
+    }
+}