tim007 tim007
/
drugi_zad
Anesa Drakovac Amer Ratković
Diff: main.cpp
- Revision:
- 0:936716d22580
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 06 13:53:29 2014 +0000 @@ -0,0 +1,42 @@ +#include "mbed.h" + +DigitalOut myled(LED1); + +int main() { + int uzlazno=1; + float u=1; + float i=1; + myled = 0; + wait(1); + myled = 1; + wait(1); + while(1) { + + if(uzlazno == 1) + { + u=u+0.06; + i=i-0.06; + myled = 0; + wait(u); + + myled = 1; + wait(i); + if(u>=1.9 || i<=0.1) + uzlazno=-1; + } + else + { + u=u-0.06; + i=i+0.06; + myled = 0; + wait(u); + + myled = 1; + wait(i); + if(i>=1.9 || u<=0.1) + uzlazno=1; + } + + + } +}