tim010 tim010 / Mbed 2 deprecated z2

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
tim010
Date:
Thu Mar 20 19:21:10 2014 +0000
Commit message:
LV3 - PAI - Grupa7- Tim010

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 Mar 20 19:21:10 2014 +0000
@@ -0,0 +1,120 @@
+#include "mbed.h"
+ 
+DigitalOut enable(dp14);
+BusOut displej(dp26, dp27, dp5, dp6, dp28, dp1, dp2);
+DigitalOut kolona[4] = {dp16, dp15, dp17, dp18};
+DigitalIn red[4] = {dp9, dp10, dp11, dp13};
+DigitalOut seg(dp25), seg1(dp23), seg2(dp24);
+ 
+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;
+}
+
+int cifra1=0, cifra2=0, cifra3=0;
+
+
+
+void ispisi(int x)
+{
+    if(cifra1!=0)
+    {
+        return;
+    }
+    int temp=cifra3;
+    cifra3=x;
+    cifra1=cifra2;
+    cifra2=temp;
+    for(;;)
+    {
+            displej = cifra3;
+            seg = 0;
+            wait(0.001);
+            seg = 1;
+            displej = cifra2;
+            seg2 = 0;
+            wait(0.001);
+            seg2=1;
+            displej=cifra1;
+            seg1 = 0;
+            wait(0.001);
+            seg1=1;
+    }
+}
+ 
+int main() {
+    enable=1;
+    
+    while(1) {
+        if(preset()==0)
+        {
+            ispisi(121);
+        }     
+        else if(preset()==1)
+        {
+            ispisi(36);
+        }
+        
+        else if(preset()==2)
+        {
+            ispisi(48);
+        }
+        
+        else if(preset()==4)
+        {
+            ispisi(25);
+        }
+        
+        else if(preset()==5)
+        {
+            ispisi(18);
+        }
+        
+        else if(preset()==6)
+        {
+            ispisi(2);
+        }
+        
+        else if(preset()==8)
+        {
+            ispisi(120);
+        }
+        
+        else if(preset()==9)
+        {
+           ispisi(0);
+        }
+        
+        else if(preset()==10)
+        {
+            ispisi(16);
+        }
+        
+        else if(preset()==13)
+        {
+            ispisi(64);
+        }
+        
+        else if(preset()==11)
+        {
+            displej=64;
+            seg=0;
+            seg1=0;
+            seg2=0;
+        }
+    }
+}
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Mar 20 19:21:10 2014 +0000
@@ -0,0 +1,1 @@
+http://world3.dev.mbed.org/users/mbed_official/code/mbed/builds/824293ae5e43
\ No newline at end of file