Adin Velic, Admira husic

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
pai2015admirahusic
Date:
Thu Mar 19 19:10:36 2015 +0000
Commit message:
LV3_Grupa7_Tim008_Zadatak2_AdinVelic_AdmiraHusic

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 19 19:10:36 2015 +0000
@@ -0,0 +1,139 @@
+#include "mbed.h"
+#define dp23 P0_0
+
+BusOut ledovi(dp26, dp27, dp5, dp6, dp28, dp1, dp2);
+BusOut pali(dp23,dp24,dp25);
+
+BusOut tacka(dp4);
+int ispisi[3];
+int izlazi[]= {121,36,48,25,18,2,120,0,16,64};
+int cif1=0;
+int cif2=0;
+int cif3=0;
+
+BusOut ledovi2(dp23, dp24, dp25, dp26, dp27, dp5, dp6, dp28);
+
+
+DigitalIn kolona4(dp13);
+DigitalIn kolona1(dp9);
+DigitalIn kolona3(dp11);
+DigitalOut red4(dp18);
+DigitalOut red3(dp17);
+DigitalOut red2(dp15);
+DigitalOut red1(dp16);
+DigitalIn kolona2(dp10);
+DigitalOut enable(dp14);
+bool poceli=false;
+
+int stepen(int i)
+{
+
+    int a=1;
+    for(int n=0; n<i; n++) {
+        a*=2;
+    }
+    return a;
+}
+int prvi;
+int drugi;
+int treci;
+int y[3]={prvi,drugi,treci};
+int x=0;
+int brcif=0;
+
+int main()
+{
+    enable=1;
+pali=0;
+
+
+    ledovi2=25;
+    wait(1);
+    ledovi2=0;
+    wait(1);
+    ledovi2=25;
+    wait(1);
+    ledovi2=0;
+    wait(1);
+    ledovi2=25;
+    wait(1);
+    ledovi2=0;
+    wait(1);
+    ledovi2=25;
+  while(1){
+    
+    if(poceli){if(brcif==0 && cif1==0) {
+        brcif++;
+        cif1=1; 
+    } else if(brcif==1 && cif2==0) {
+        drugi=prvi;
+        brcif++;
+        cif2=1; 
+    } else if(brcif==2 && cif3==0) {
+        treci=drugi;
+        drugi=prvi;
+        cif3=1; 
+    }}
+    
+    red1=1;
+    if(kolona1)
+        {prvi=izlazi[0]; poceli=true;}
+    else if(kolona2)
+       { prvi=izlazi[1]; poceli=true; }
+    else if(kolona3) {prvi=izlazi[2]; poceli=true;}
+    
+    red1=0;
+
+    red2=1;
+
+    if(kolona1) prvi=izlazi[3];
+    else  if(kolona2) { prvi=izlazi[4]; poceli=true;}
+    else  if(kolona3) { prvi=izlazi[5]; poceli=true;
+    }
+    else  if(kolona4) {ledovi=207; poceli=true;
+    }
+    red2=0;
+
+    red3=1;
+    if(kolona1) {prvi=izlazi[6]; poceli=true; }
+    else  if(kolona2) {prvi=izlazi[7]; poceli=true; }
+    else if(kolona3) {prvi=izlazi[8]; poceli=true; }
+    else  if(kolona4) {
+        prvi=0;
+        drugi=0;
+        cif1=cif2=cif3=0;
+        treci=0;
+        brcif=0;
+        poceli=true;
+    }
+    red3=0;
+
+    red4=1;
+     if(kolona2==1) {prvi=izlazi[9]; poceli=true;}
+    red4=0;
+int i;
+    if(brcif==0) {
+        i=2;
+        pali=3;
+       ledovi=y[i];
+        wait(0.5);
+    } else if ( brcif==1) {
+        if(i==1) i=-1;
+        i++;
+        pali=stepen(i)+1;ledovi=y[i];
+        wait(0.5);
+
+    } else if(brcif==2) {
+        if(i==2) i=-1;
+        i++;
+        pali=stepen(i)+1;
+        ledovi=y[i];
+        wait(0.5);
+    }
+    
+ 
+
+}
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Mar 19 19:10:36 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0
\ No newline at end of file