Simulacija rada semafora s 4 LED diode, 7 segmentog display-a, zvučnika, tipkala i potenciometra

Dependencies:   mbed

https://os.mbed.com/media/uploads/dcindric/picture1.png

Committer:
dcindric
Date:
Fri May 07 10:33:28 2021 +0000
Revision:
1:1b7ec94fe4ab
Parent:
0:2531c2b824f9
Konstukcijski Cindric

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dcindric 0:2531c2b824f9 1 #include "mbed.h"
dcindric 0:2531c2b824f9 2 #include "svjetla.h"
dcindric 0:2531c2b824f9 3 #include "segmentni.h"
dcindric 0:2531c2b824f9 4 #include "buzzer.h"
dcindric 0:2531c2b824f9 5
dcindric 0:2531c2b824f9 6 InterruptIn gumbPjesaci(USER_BUTTON);
dcindric 0:2531c2b824f9 7 DigitalIn gumbKvar(PC_12);
dcindric 0:2531c2b824f9 8 Ticker flipper;
dcindric 0:2531c2b824f9 9 Serial pc1(USBTX, USBRX);
dcindric 0:2531c2b824f9 10
dcindric 0:2531c2b824f9 11 int main()
dcindric 0:2531c2b824f9 12 {
dcindric 0:2531c2b824f9 13 int temp = 0;
dcindric 0:2531c2b824f9 14 gumbPjesaci.rise(&funkcijaPjesaci);
dcindric 0:2531c2b824f9 15 SegConvert(11);
dcindric 0:2531c2b824f9 16 while(1) {
dcindric 0:2531c2b824f9 17 if(gumbKvar == 1 && temp == 0) {
dcindric 0:2531c2b824f9 18 pc1.printf("Semafor u kvaru \n \r");
dcindric 0:2531c2b824f9 19 flipper.attach(&kvar, 0.5);
dcindric 0:2531c2b824f9 20 temp++;
dcindric 0:2531c2b824f9 21 } else if(gumbKvar == 0) {
dcindric 0:2531c2b824f9 22 pc1.printf("Semafor u radu \n \r");
dcindric 0:2531c2b824f9 23 flipper.detach();
dcindric 0:2531c2b824f9 24 semafor();
dcindric 0:2531c2b824f9 25 temp = 0;
dcindric 0:2531c2b824f9 26 pc1.printf("\n \r");
dcindric 0:2531c2b824f9 27 }
dcindric 0:2531c2b824f9 28 }
dcindric 0:2531c2b824f9 29 }
dcindric 0:2531c2b824f9 30
dcindric 0:2531c2b824f9 31