TVZ2020 / Mbed 2 deprecated kontrola_ulaza_IF

Dependencies:   mbed Ledica

Files at this revision

API Documentation at this revision

Comitter:
ifluka
Date:
Fri May 07 08:44:34 2021 +0000
Commit message:
KONTROLA ULAZA

Changed in this revision

Ledica.lib Show annotated file Show diff for this revision Revisions of this file
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/Ledica.lib	Fri May 07 08:44:34 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/TVZ2020/code/Ledica/#aa26b9c6dc15
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri May 07 08:44:34 2021 +0000
@@ -0,0 +1,67 @@
+#include "mbed.h"
+#include "Ledica.h"
+
+Indicator crvena (D11);
+Indicator zelena (D12);
+
+InterruptIn senzor_ulaz(D9);
+InterruptIn senzor_izlaz(D10);
+
+BusOut Disp(D2,D3,D4,D5,D6,D7,D8); 
+char SegConvert(char SegValue); 
+int br=0,t=0;
+
+Ticker tik1;
+
+void tiker1()
+{
+    t=t+1;
+}
+
+void ulaz()
+{
+    if(br<9)
+    br++;;
+    if(br==9);
+}
+
+void izlaz()
+{
+    if(br>=0)
+    br--;;
+}
+
+char SegConvert(char SegValue) { 
+char SegByte=0x00;
+switch (SegValue) { //DPGFEDCBA
+case 0 : SegByte = 0x3F;break; // 00111111 binary
+case 1 : SegByte = 0x06;break; // 00000110 binary
+case 2 : SegByte = 0x5B;break; // 01011011 binary
+case 3 : SegByte = 0x4F;break; // 01001111 binary
+case 4 : SegByte = 0x66;break; // 01100110 binary
+case 5 : SegByte = 0x6D;break; // 01101101 binary
+case 6 : SegByte = 0x7D;break; // 01111101 binary
+case 7 : SegByte = 0x07;break; // 00000111 binary
+case 8 : SegByte = 0x7F;break; // 01111111 binary
+case 9 : SegByte = 0x6F;break; // 01101111 binary
+}
+return SegByte;
+}
+
+int main() {
+    tik1.attach(&tiker1, 0.01);
+    while(1) {
+        senzor_ulaz.fall(&ulaz);
+        senzor_izlaz.fall(&izlaz);
+        Disp=SegConvert(br);
+        if(br>=0 && br<=8)
+        zelena.light_on(t, 0, 100);
+        if(br==8 )
+        crvena.light_on(t, 0, 100);
+        if(br==9 ){
+        crvena.light_on(t, 0, 5);
+        }
+        if(t>=100)
+        t=0;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri May 07 08:44:34 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file