Ispis polja

Files at this revision

API Documentation at this revision

Comitter:
atopcic
Date:
Mon Feb 22 08:22:50 2021 +0000
Commit message:
datoteke

Changed in this revision

Ispis.cpp Show annotated file Show diff for this revision Revisions of this file
Ispis.h Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r ccb8b3997ba7 Ispis.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Ispis.cpp	Mon Feb 22 08:22:50 2021 +0000
@@ -0,0 +1,76 @@
+// funkcija ispisa:
+#include "Ispis.h"
+
+
+DigitalOut L15(D15);
+DigitalOut L14(D14);
+DigitalOut L13(D13);
+DigitalOut L12(D12);
+DigitalOut L11(D11);
+DigitalOut L10(D10);
+DigitalOut L9(D9);
+DigitalOut L8(D8);
+DigitalOut G3(D7);
+DigitalOut G2(D6);
+DigitalOut G1(D5);
+
+Timer  timer1;
+int vrijednost,trenutniStupac=0;
+
+void ispis(void){
+    if(timer1.read_ms() >= 1){  
+for(int i = 0; i < 8; i++){
+     vrijednost=polje[i][trenutniStupac];
+     
+     switch(i){
+      case 0:
+         if(vrijednost==1) L11=1;
+            else L11=0; break;
+      case 1:
+        if(vrijednost==1) L10=1;
+            else L10=0; break;
+      case 2:
+          if(vrijednost==1) L9=1;
+            else L9=0; break;
+      case 3:
+          if(vrijednost==1) L8=1;
+            else L8=0; break;
+      case 4:
+          if(vrijednost==1) L12=1;
+            else L12=0; break;
+      case 5:
+          if(vrijednost==1) L13=1;
+            else L13=0; break;
+      case 6:
+          if(vrijednost==1) L14=1;
+            else L14=0; break;
+      case 7:
+          if(vrijednost==1) L15=1;
+            else L15=0; break;
+        }
+    }
+
+    switch(trenutniStupac){
+      case 0:
+         G1=1; G2=0; G3=0; break;
+      case 1:
+         G1=1; G2=0; G3=1; break;
+      case 2:
+          G1=1; G2=1; G3=0; break;
+      case 3:
+          G1=1; G2=1; G3=1; break;
+      case 4:
+          G1=0; G2=0; G3=0; break;
+      case 5:
+          G1=0; G2=0; G3=1; break;
+      case 6:
+          G1=0; G2=1; G3=0; break;
+      case 7:
+          G1=0; G2=1; G3=1; break;
+        }
+
+    trenutniStupac++;
+    trenutniStupac %= 8; 
+     timer1.reset();
+    }
+    }
\ No newline at end of file
diff -r 000000000000 -r ccb8b3997ba7 Ispis.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Ispis.h	Mon Feb 22 08:22:50 2021 +0000
@@ -0,0 +1,22 @@
+#ifndef ISPIS_H
+#define ISPIS_H
+#include "mbed.h"
+
+extern int polje[8][8];
+extern DigitalOut L15;
+extern DigitalOut L14;
+extern DigitalOut L13;
+extern DigitalOut L12;
+extern DigitalOut L11;
+extern DigitalOut L10;
+extern DigitalOut L9;
+extern DigitalOut L8;
+extern DigitalOut G3;
+extern DigitalOut G2;
+extern DigitalOut G1;
+
+extern Timer  timer1;
+extern int vrijednost, trenutniStupac;
+
+void ispis(void);
+#endif 
\ No newline at end of file