Nedim Hozić Kenan Mahmutović

Dependencies:   mbed

Revision:
0:80e5f4679474
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 08 18:06:58 2014 +0000
@@ -0,0 +1,70 @@
+#include "mbed.h"
+#include <ctype.h>
+
+DigitalOut kolona[4] = {dp6, dp28, dp1, dp2};
+DigitalIn red[4] = {dp9, dp10, dp11, dp13};
+
+Serial pc(USBTX, USBRX); // tx, rx
+Ticker t;
+int preset()
+{
+    for(int i=0; i<4; i++)
+    {
+        kolona[i] = 1;
+        for(int j=0; j<4; j++)
+        {
+            if(red[j]==1)
+            {
+            kolona[i] = 0;
+            return 4*i+j;
+            }
+        }
+        kolona[i] = 0;
+    }
+    return -1;
+}
+
+void ispisi()
+{
+    switch(preset()){
+    case 0:
+    pc.putc('1'); break;
+    case 1: 
+    pc.putc('2'); break;
+    case 2: 
+    pc.putc('3'); break;
+    case 3: 
+    pc.putc('A'); break;
+    case 4: 
+    pc.putc('4'); break;
+    case 5: 
+    pc.putc('5'); break;
+    case 6: 
+    pc.putc('6'); break;
+    case 7: 
+    pc.putc('B'); break;
+    case 8: 
+    pc.putc('7'); break;
+    case 9: 
+    pc.putc('8'); break;
+    case 10: 
+    pc.putc('9'); break;
+    case 11: 
+    pc.putc('C'); break;
+    case 12: 
+    pc.putc('\n'); break;
+    case 13: 
+    pc.putc('0'); break;
+    case 14: 
+    pc.putc('#'); break;
+    case 15: 
+    pc.putc('D'); break;
+    default: break;
+}
+}
+
+int main() {
+
+        t.attach(ispisi, 0.2);   
+    while(1);
+}