Adam Stanić
/
LV1ZAD5
LV1ZAD5 Adam Stanic, Alen Sjenicaku
main.cpp@0:76af52e75515, 2016-03-08 (annotated)
- Committer:
- 2016US_AdamStanic
- Date:
- Tue Mar 08 00:00:40 2016 +0000
- Revision:
- 0:76af52e75515
LV1ZAD5 Adam Stanic, Alen Sjenicaku
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
2016US_AdamStanic | 0:76af52e75515 | 1 | #include "mbed.h" |
2016US_AdamStanic | 0:76af52e75515 | 2 | |
2016US_AdamStanic | 0:76af52e75515 | 3 | DigitalOut crvena(LED1); |
2016US_AdamStanic | 0:76af52e75515 | 4 | DigitalOut zelena(LED2); |
2016US_AdamStanic | 0:76af52e75515 | 5 | DigitalOut plava(LED3); |
2016US_AdamStanic | 0:76af52e75515 | 6 | |
2016US_AdamStanic | 0:76af52e75515 | 7 | |
2016US_AdamStanic | 0:76af52e75515 | 8 | |
2016US_AdamStanic | 0:76af52e75515 | 9 | |
2016US_AdamStanic | 0:76af52e75515 | 10 | int main() |
2016US_AdamStanic | 0:76af52e75515 | 11 | { |
2016US_AdamStanic | 0:76af52e75515 | 12 | float koeficijent=0.03; |
2016US_AdamStanic | 0:76af52e75515 | 13 | |
2016US_AdamStanic | 0:76af52e75515 | 14 | |
2016US_AdamStanic | 0:76af52e75515 | 15 | float pauza=1; |
2016US_AdamStanic | 0:76af52e75515 | 16 | float rad = 1; |
2016US_AdamStanic | 0:76af52e75515 | 17 | float sekunda = 1; |
2016US_AdamStanic | 0:76af52e75515 | 18 | |
2016US_AdamStanic | 0:76af52e75515 | 19 | bool parno = true; |
2016US_AdamStanic | 0:76af52e75515 | 20 | |
2016US_AdamStanic | 0:76af52e75515 | 21 | int brojac=1; |
2016US_AdamStanic | 0:76af52e75515 | 22 | |
2016US_AdamStanic | 0:76af52e75515 | 23 | while(1) |
2016US_AdamStanic | 0:76af52e75515 | 24 | { |
2016US_AdamStanic | 0:76af52e75515 | 25 | |
2016US_AdamStanic | 0:76af52e75515 | 26 | |
2016US_AdamStanic | 0:76af52e75515 | 27 | |
2016US_AdamStanic | 0:76af52e75515 | 28 | crvena=0; |
2016US_AdamStanic | 0:76af52e75515 | 29 | zelena=1; |
2016US_AdamStanic | 0:76af52e75515 | 30 | plava=1; |
2016US_AdamStanic | 0:76af52e75515 | 31 | wait(rad); |
2016US_AdamStanic | 0:76af52e75515 | 32 | |
2016US_AdamStanic | 0:76af52e75515 | 33 | crvena=1; |
2016US_AdamStanic | 0:76af52e75515 | 34 | zelena=1; |
2016US_AdamStanic | 0:76af52e75515 | 35 | plava=1; |
2016US_AdamStanic | 0:76af52e75515 | 36 | wait(pauza); |
2016US_AdamStanic | 0:76af52e75515 | 37 | |
2016US_AdamStanic | 0:76af52e75515 | 38 | if(parno) |
2016US_AdamStanic | 0:76af52e75515 | 39 | { |
2016US_AdamStanic | 0:76af52e75515 | 40 | rad = rad + koeficijent; |
2016US_AdamStanic | 0:76af52e75515 | 41 | pauza = pauza - koeficijent; |
2016US_AdamStanic | 0:76af52e75515 | 42 | } |
2016US_AdamStanic | 0:76af52e75515 | 43 | else |
2016US_AdamStanic | 0:76af52e75515 | 44 | { |
2016US_AdamStanic | 0:76af52e75515 | 45 | rad = rad - koeficijent; |
2016US_AdamStanic | 0:76af52e75515 | 46 | pauza = pauza + koeficijent; |
2016US_AdamStanic | 0:76af52e75515 | 47 | } |
2016US_AdamStanic | 0:76af52e75515 | 48 | |
2016US_AdamStanic | 0:76af52e75515 | 49 | |
2016US_AdamStanic | 0:76af52e75515 | 50 | brojac++; |
2016US_AdamStanic | 0:76af52e75515 | 51 | |
2016US_AdamStanic | 0:76af52e75515 | 52 | if(brojac==30) |
2016US_AdamStanic | 0:76af52e75515 | 53 | { |
2016US_AdamStanic | 0:76af52e75515 | 54 | if(parno) |
2016US_AdamStanic | 0:76af52e75515 | 55 | parno = false; |
2016US_AdamStanic | 0:76af52e75515 | 56 | else |
2016US_AdamStanic | 0:76af52e75515 | 57 | parno = true; |
2016US_AdamStanic | 0:76af52e75515 | 58 | |
2016US_AdamStanic | 0:76af52e75515 | 59 | brojac=0; |
2016US_AdamStanic | 0:76af52e75515 | 60 | } |
2016US_AdamStanic | 0:76af52e75515 | 61 | } |
2016US_AdamStanic | 0:76af52e75515 | 62 | } |
2016US_AdamStanic | 0:76af52e75515 | 63 |