Amer Ratkovic Emir Mujacic

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
tim003
Date:
Thu May 08 13:23:17 2014 +0000
Commit message:
LAB8-PAI-Grupa5-Tim003-Zadatak2

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 08 13:23:17 2014 +0000
@@ -0,0 +1,61 @@
+#include "mbed.h"
+
+Serial PC (USBTX, USBRX);
+
+DigitalIn kol1(dp9), kol2(dp10),kol3(dp11), kol4(dp13);
+DigitalOut red1(dp2), red2(dp1), red3(dp28),red4(dp6);
+
+Timer t;
+char slovo;
+char ocitaj()
+{
+    red1=0;red2=0;red3=0;red4=0;
+    red1=1;
+    if(kol1==1) return '1';
+    if(kol2==1) return '2';
+    if(kol3==1) return '3';
+    if(kol4==1) return 'A';
+
+    red1=0;
+    red2=1;
+    if(kol1==1) return '4';
+    if(kol2==1) return '5';
+    if(kol3==1) return '6';
+    if(kol4==1) return 'B';
+    red2=0;
+    red3=1;
+    if(kol1==1) return '7';
+    if(kol2==1) return '8';
+    if(kol3==1) return '9';
+    if(kol4==1) return 'C';
+    red3=0;
+    red4=1;
+    if(kol1==1) return '\n';
+    if(kol2==1) return '0';
+    if(kol3==1) return '#';
+    if(kol4==1) return 'D';
+    red4=0;
+    return 'X';
+}
+
+
+void funkcija()
+{
+    if(t.read_ms() < 222)
+        return;
+    slovo = ocitaj();
+    if(slovo == 'X')
+        return;
+    PC.printf("%c",slovo);
+
+    t.reset();
+}
+
+int main()
+{
+    t.start();
+    while(1)
+    {
+        funkcija();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 08 13:23:17 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file