Mesud Klisura

Dependencies:   mbed

Revision:
0:02ce06f2f4a3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Mar 13 19:28:08 2014 +0000
@@ -0,0 +1,67 @@
+#include "mbed.h"
+
+BusOut led(dp23,dp24,dp25,dp26,dp27,dp5,dp6,dp28);
+DigitalOut enable(dp14);
+
+BusOut red(dp16,dp15,dp17,dp18);
+BusIn kolona(dp9,dp10,dp11,dp13);
+
+
+int Pressed(BusIn kolona, BusOut red)
+{
+   int A=10;
+   int B=11;
+   int C=12;
+   int D=13;
+   int zvijezda =20;
+   int resetka =40;
+   
+   red=8;
+   if(kolona==8) return A;
+   else if (kolona==4) return 3;
+   else if (kolona==2) return 2;
+   else if (kolona==1) return 1;
+   red=0;
+   
+   red=4;
+   if(kolona==8) return B;
+   else if (kolona==4) return 6;
+   else if (kolona==2) return 5;
+   else if (kolona==1) return 4; 
+   red=0;
+
+   red=2;
+   if(kolona==8) return C;
+   else if (kolona==4) return 9;
+   else if (kolona==2) return 8;
+   else if (kolona==1) return 7;
+   red=0;
+   
+   red=1;
+   if(kolona==8) return D;
+   else if (kolona==4) return zvijezda;
+   else if (kolona==2) return 0;
+   else if (kolona==1) return resetka;   
+   red=0;
+
+   return 0;  
+}
+
+
+
+
+int main() {
+    
+  enable = 0;
+  led = 0;
+        int pritisnuto=0;Pressed(kolona,red);
+  while(1) 
+  {
+    pritisnuto=Pressed(kolona,red);
+    if(pritisnuto==10)
+    led= 129;
+    else led=pritisnuto;
+    wait(1);
+    
+  }
+}