tim004 tim004
/
LV1_Grupa1_Tim004
Čilić Zlatan Đenašević Emir
main.cpp@0:c5225f137c6e, 2014-03-03 (annotated)
- Committer:
- tim004
- Date:
- Mon Mar 03 07:33:44 2014 +0000
- Revision:
- 0:c5225f137c6e
LV1 - PAI - Grupa1 - Tim004
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tim004 | 0:c5225f137c6e | 1 | #include "mbed.h" |
tim004 | 0:c5225f137c6e | 2 | |
tim004 | 0:c5225f137c6e | 3 | DigitalOut myled(LED2); |
tim004 | 0:c5225f137c6e | 4 | |
tim004 | 0:c5225f137c6e | 5 | int main() { |
tim004 | 0:c5225f137c6e | 6 | float turnOn=1.0, turnOff=1.0, koeficijent=0.06; |
tim004 | 0:c5225f137c6e | 7 | while(1) { |
tim004 | 0:c5225f137c6e | 8 | while(turnOn < 1.9) |
tim004 | 0:c5225f137c6e | 9 | { |
tim004 | 0:c5225f137c6e | 10 | myled = 0; |
tim004 | 0:c5225f137c6e | 11 | wait (turnOn); |
tim004 | 0:c5225f137c6e | 12 | myled = 1; |
tim004 | 0:c5225f137c6e | 13 | wait (turnOff); |
tim004 | 0:c5225f137c6e | 14 | turnOn += koeficijent; |
tim004 | 0:c5225f137c6e | 15 | turnOff -= koeficijent; |
tim004 | 0:c5225f137c6e | 16 | } |
tim004 | 0:c5225f137c6e | 17 | while(turnOn > 0.1) |
tim004 | 0:c5225f137c6e | 18 | { |
tim004 | 0:c5225f137c6e | 19 | myled = 0; |
tim004 | 0:c5225f137c6e | 20 | wait (turnOn); |
tim004 | 0:c5225f137c6e | 21 | myled = 1; |
tim004 | 0:c5225f137c6e | 22 | wait (turnOff); |
tim004 | 0:c5225f137c6e | 23 | turnOn -= koeficijent; |
tim004 | 0:c5225f137c6e | 24 | turnOff += koeficijent; |
tim004 | 0:c5225f137c6e | 25 | |
tim004 | 0:c5225f137c6e | 26 | } |
tim004 | 0:c5225f137c6e | 27 | } |
tim004 | 0:c5225f137c6e | 28 | } |