Simulacija rada semafora s 4 LED diode, 7 segmentog display-a, zvučnika, tipkala i potenciometra
Dependencies: mbed
main.cpp@0:2531c2b824f9, 2021-05-06 (annotated)
- Committer:
- dcindric
- Date:
- Thu May 06 18:55:48 2021 +0000
- Revision:
- 0:2531c2b824f9
- Child:
- 1:1b7ec94fe4ab
Konstukcijski Cindric
Who changed what in which revision?
User | Revision | Line number | New 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 | |
dcindric | 0:2531c2b824f9 | 22 | } else if(gumbKvar == 0) { |
dcindric | 0:2531c2b824f9 | 23 | pc1.printf("Semafor u radu \n \r"); |
dcindric | 0:2531c2b824f9 | 24 | flipper.detach(); |
dcindric | 0:2531c2b824f9 | 25 | semafor(); |
dcindric | 0:2531c2b824f9 | 26 | temp = 0; |
dcindric | 0:2531c2b824f9 | 27 | pc1.printf("\n \r"); |
dcindric | 0:2531c2b824f9 | 28 | } |
dcindric | 0:2531c2b824f9 | 29 | |
dcindric | 0:2531c2b824f9 | 30 | } |
dcindric | 0:2531c2b824f9 | 31 | } |
dcindric | 0:2531c2b824f9 | 32 | |
dcindric | 0:2531c2b824f9 | 33 |