Ispis polja

Committer:
atopcic
Date:
Mon Feb 22 08:22:50 2021 +0000
Revision:
0:ccb8b3997ba7
datoteke

Who changed what in which revision?

UserRevisionLine numberNew contents of line
atopcic 0:ccb8b3997ba7 1 // funkcija ispisa:
atopcic 0:ccb8b3997ba7 2 #include "Ispis.h"
atopcic 0:ccb8b3997ba7 3
atopcic 0:ccb8b3997ba7 4
atopcic 0:ccb8b3997ba7 5 DigitalOut L15(D15);
atopcic 0:ccb8b3997ba7 6 DigitalOut L14(D14);
atopcic 0:ccb8b3997ba7 7 DigitalOut L13(D13);
atopcic 0:ccb8b3997ba7 8 DigitalOut L12(D12);
atopcic 0:ccb8b3997ba7 9 DigitalOut L11(D11);
atopcic 0:ccb8b3997ba7 10 DigitalOut L10(D10);
atopcic 0:ccb8b3997ba7 11 DigitalOut L9(D9);
atopcic 0:ccb8b3997ba7 12 DigitalOut L8(D8);
atopcic 0:ccb8b3997ba7 13 DigitalOut G3(D7);
atopcic 0:ccb8b3997ba7 14 DigitalOut G2(D6);
atopcic 0:ccb8b3997ba7 15 DigitalOut G1(D5);
atopcic 0:ccb8b3997ba7 16
atopcic 0:ccb8b3997ba7 17 Timer timer1;
atopcic 0:ccb8b3997ba7 18 int vrijednost,trenutniStupac=0;
atopcic 0:ccb8b3997ba7 19
atopcic 0:ccb8b3997ba7 20 void ispis(void){
atopcic 0:ccb8b3997ba7 21 if(timer1.read_ms() >= 1){
atopcic 0:ccb8b3997ba7 22 for(int i = 0; i < 8; i++){
atopcic 0:ccb8b3997ba7 23 vrijednost=polje[i][trenutniStupac];
atopcic 0:ccb8b3997ba7 24
atopcic 0:ccb8b3997ba7 25 switch(i){
atopcic 0:ccb8b3997ba7 26 case 0:
atopcic 0:ccb8b3997ba7 27 if(vrijednost==1) L11=1;
atopcic 0:ccb8b3997ba7 28 else L11=0; break;
atopcic 0:ccb8b3997ba7 29 case 1:
atopcic 0:ccb8b3997ba7 30 if(vrijednost==1) L10=1;
atopcic 0:ccb8b3997ba7 31 else L10=0; break;
atopcic 0:ccb8b3997ba7 32 case 2:
atopcic 0:ccb8b3997ba7 33 if(vrijednost==1) L9=1;
atopcic 0:ccb8b3997ba7 34 else L9=0; break;
atopcic 0:ccb8b3997ba7 35 case 3:
atopcic 0:ccb8b3997ba7 36 if(vrijednost==1) L8=1;
atopcic 0:ccb8b3997ba7 37 else L8=0; break;
atopcic 0:ccb8b3997ba7 38 case 4:
atopcic 0:ccb8b3997ba7 39 if(vrijednost==1) L12=1;
atopcic 0:ccb8b3997ba7 40 else L12=0; break;
atopcic 0:ccb8b3997ba7 41 case 5:
atopcic 0:ccb8b3997ba7 42 if(vrijednost==1) L13=1;
atopcic 0:ccb8b3997ba7 43 else L13=0; break;
atopcic 0:ccb8b3997ba7 44 case 6:
atopcic 0:ccb8b3997ba7 45 if(vrijednost==1) L14=1;
atopcic 0:ccb8b3997ba7 46 else L14=0; break;
atopcic 0:ccb8b3997ba7 47 case 7:
atopcic 0:ccb8b3997ba7 48 if(vrijednost==1) L15=1;
atopcic 0:ccb8b3997ba7 49 else L15=0; break;
atopcic 0:ccb8b3997ba7 50 }
atopcic 0:ccb8b3997ba7 51 }
atopcic 0:ccb8b3997ba7 52
atopcic 0:ccb8b3997ba7 53 switch(trenutniStupac){
atopcic 0:ccb8b3997ba7 54 case 0:
atopcic 0:ccb8b3997ba7 55 G1=1; G2=0; G3=0; break;
atopcic 0:ccb8b3997ba7 56 case 1:
atopcic 0:ccb8b3997ba7 57 G1=1; G2=0; G3=1; break;
atopcic 0:ccb8b3997ba7 58 case 2:
atopcic 0:ccb8b3997ba7 59 G1=1; G2=1; G3=0; break;
atopcic 0:ccb8b3997ba7 60 case 3:
atopcic 0:ccb8b3997ba7 61 G1=1; G2=1; G3=1; break;
atopcic 0:ccb8b3997ba7 62 case 4:
atopcic 0:ccb8b3997ba7 63 G1=0; G2=0; G3=0; break;
atopcic 0:ccb8b3997ba7 64 case 5:
atopcic 0:ccb8b3997ba7 65 G1=0; G2=0; G3=1; break;
atopcic 0:ccb8b3997ba7 66 case 6:
atopcic 0:ccb8b3997ba7 67 G1=0; G2=1; G3=0; break;
atopcic 0:ccb8b3997ba7 68 case 7:
atopcic 0:ccb8b3997ba7 69 G1=0; G2=1; G3=1; break;
atopcic 0:ccb8b3997ba7 70 }
atopcic 0:ccb8b3997ba7 71
atopcic 0:ccb8b3997ba7 72 trenutniStupac++;
atopcic 0:ccb8b3997ba7 73 trenutniStupac %= 8;
atopcic 0:ccb8b3997ba7 74 timer1.reset();
atopcic 0:ccb8b3997ba7 75 }
atopcic 0:ccb8b3997ba7 76 }