MU_konstrukcijski zadatak_VD
Dependents: MU_upravljanje_raskrzjem_VD
MU_upravljanje_raskrzjem.cpp@0:fd1214c429d2, 2020-11-25 (annotated)
- Committer:
- Vdavidovi
- Date:
- Wed Nov 25 16:27:02 2020 +0000
- Revision:
- 0:fd1214c429d2
MU_upravljanje_raskrzjem
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Vdavidovi | 0:fd1214c429d2 | 1 | #include "MU_upravljanje_raskrzjem.h" |
Vdavidovi | 0:fd1214c429d2 | 2 | #include "mbed.h" |
Vdavidovi | 0:fd1214c429d2 | 3 | Traffic::Traffic(PinName lightPin) : light(lightPin) { |
Vdavidovi | 0:fd1214c429d2 | 4 | |
Vdavidovi | 0:fd1214c429d2 | 5 | } |
Vdavidovi | 0:fd1214c429d2 | 6 | |
Vdavidovi | 0:fd1214c429d2 | 7 | void Traffic::light_on(int t, int v1, int v2) { |
Vdavidovi | 0:fd1214c429d2 | 8 | |
Vdavidovi | 0:fd1214c429d2 | 9 | if(t>=v1 && t<v2) |
Vdavidovi | 0:fd1214c429d2 | 10 | light=1; |
Vdavidovi | 0:fd1214c429d2 | 11 | wait(0.00001); |
Vdavidovi | 0:fd1214c429d2 | 12 | light=0; |
Vdavidovi | 0:fd1214c429d2 | 13 | } |