tim010 tim010
/
LV1_Grupa6_Tim010_Zadatak5
Muris Nuhodžić Hamdija Sinanović
main.cpp@0:e644a6fec797, 2014-03-06 (annotated)
- Committer:
- tim010
- Date:
- Thu Mar 06 16:39:04 2014 +0000
- Revision:
- 0:e644a6fec797
Muris Nuhod?i?; Hamdija Sinanovi?
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tim010 | 0:e644a6fec797 | 1 | #include "mbed.h" |
tim010 | 0:e644a6fec797 | 2 | |
tim010 | 0:e644a6fec797 | 3 | |
tim010 | 0:e644a6fec797 | 4 | DigitalOut myled(LED1); |
tim010 | 0:e644a6fec797 | 5 | |
tim010 | 0:e644a6fec797 | 6 | int main() { |
tim010 | 0:e644a6fec797 | 7 | float x = 0.005; |
tim010 | 0:e644a6fec797 | 8 | int znak = 1; |
tim010 | 0:e644a6fec797 | 9 | while(1) { |
tim010 | 0:e644a6fec797 | 10 | myled = 0; |
tim010 | 0:e644a6fec797 | 11 | wait(x); |
tim010 | 0:e644a6fec797 | 12 | myled = 1; |
tim010 | 0:e644a6fec797 | 13 | wait(0.01-x); |
tim010 | 0:e644a6fec797 | 14 | if((x <= 0.0001) || (x >= 0.0099)) znak *= -1; |
tim010 | 0:e644a6fec797 | 15 | x += znak*(0.0049/199); |
tim010 | 0:e644a6fec797 | 16 | } |
tim010 | 0:e644a6fec797 | 17 | } |