Agić Lejla Đenašević Emir

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
tim008
Date:
Mon Mar 17 08:57:51 2014 +0000
Commit message:
LV3 - PAI - Grupa1- Tim008

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	Mon Mar 17 08:57:51 2014 +0000
@@ -0,0 +1,66 @@
+#include "mbed.h"
+
+DigitalIn kolone[4]={dp9, dp10, dp11, dp13};
+DigitalOut redovi[4]={dp16, dp15, dp17, dp18};
+BusOut cifre(dp23, dp24, dp25);
+BusOut ekran(dp26, dp27, dp5, dp6, dp28, dp1, dp2);
+int brojevi[10]= {0x40, 0xf9, 0x24, 0x30, 0x19, 0x12, 0x02, 0xf8, 0x00, 0x10};
+int brojac=0;
+
+int vrijednosti[3];
+char taster(){
+    char a='F';
+    for(int i=0; i<4; i++){   
+        redovi[i]=1;
+        if(i==0){
+            if(kolone[0]==1) a='1';
+            if(kolone[1]==1) a='2';
+            if(kolone[2]==1) a='3';
+        }
+        else if(i==1){
+            if(kolone[0]==1) a='4';
+            if(kolone[1]==1) a='5';
+            if(kolone[2]==1) a='6';
+        }
+        else if(i==2){
+            if(kolone[0]==1) {a='7'; wait(10000);};
+            if(kolone[1]==1) a='8';
+            if(kolone[2]==1) a='9';
+            if(kolone[3]==1) a='C';
+        }
+        else if(i==3){
+            if(kolone[1]==1) a='0';
+        }  
+       redovi[i]=0;  
+    }
+    return a;
+}
+
+void prikaz(char znak){
+    if(znak == 'c')
+    {
+        vrijednosti[0]=0;
+        vrijednosti[1]=0;
+        vrijednosti[2]=0;
+    }
+    else if(znak>='0' &&  znak<='9')
+    {
+        vrijednosti[2]=vrijednosti[1];
+        vrijednosti[1]=vrijednosti[0];
+        vrijednosti[0]=znak-'0';
+    }
+    for(int i=1;i<=4;i=i*2)
+    {
+        cifre=i;
+        ekran=brojevi[vrijednosti[2-i/2]];
+        wait_ms(10);
+    }
+}
+
+int main() {
+    char pom;
+    while(1) {
+        pom=taster();
+        prikaz(pom);        
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Mar 17 08:57:51 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8e73be2a2ac1
\ No newline at end of file