Admira Husić
/
LV3_Grupa7_Tim008_Zadatak1
Admira husic Adin Velić
main.cpp
- Committer:
- pai2015admirahusic
- Date:
- 2015-03-19
- Revision:
- 0:51786d5a7130
File content as of revision 0:51786d5a7130:
#include "mbed.h" #define dp23 P0_0 BusOut ledovi(dp26, dp27, dp5, dp6, dp28, dp1, dp2); BusOut pali(dp23,dp24,dp25); int stepen[]= {6,5,3}; BusOut tacka(dp4); int ispisi[3]; int izlazi[]= {64,121,36,48,25,18,2,120,0,16}; DigitalOut enable(dp14); int stani=0; int main() { enable=1; pali=0; ledovi=25; wait(1); ledovi=0; wait(1); ledovi=25; wait(1); ledovi=0; wait(1); ledovi=25; wait(1); tacka=1; wait(2); while(1) { int sek=0; ispisi[0]=0; for(int i=2; i<13; i++) { ispisi[1]=sek; for(int j=0; j<9; j++) { ispisi[2]=j; int m=0; for(int k=0; k<33; k++) { if(m==3) m=-1; pali=stepen[m]; ledovi=izlazi[ispisi[m]]; if(pali==5) tacka=0; else tacka=1; m++; wait(0.002); } if(j==3 && i==12 ) {while(1){int m=0; for(int k=0; k<33; k++) { if(m==3) m=-1; pali=stepen[m]; ledovi=izlazi[ispisi[m]]; if(pali==5) tacka=0; else tacka=1; m++; wait(0.002);}}} } if(i>=9 && sek>=7) { ispisi[0]=1; sek=0; } else sek++; } } int k=0; ispisi[0]=1; ispisi[1]=2; ispisi[2]=3; while(1){ if(k==3) k=-1; k++; pali=stepen[k]; ledovi=izlazi[ispisi[k]]; if(pali==2) tacka=0; else tacka=1; wait(0.033); } }