Sumejja Porca Elma Gazetic

Dependencies:   mbed

Fork of LV1_Grupa4_Tim003 by tim003 tim003

Revision:
4:af7001476e2c
Parent:
3:a91eff91bd00
Child:
5:af6d1571373e
diff -r a91eff91bd00 -r af7001476e2c main.cpp
--- a/main.cpp	Mon Mar 03 17:46:06 2014 +0000
+++ b/main.cpp	Mon Mar 03 17:57:47 2014 +0000
@@ -1,23 +1,24 @@
 #include "mbed.h"
 
-DigitalOut myled(LED3);
+DigitalOut myled1(LED1);
+DigitalOut myled2(LED2);
+DigitalOut myled3(LED3);
+
 
 int main() {
-    
-    float vrijeme1 = 1, vrijeme2 = 1;
-    int f = 1;
+    myled1 = myled2 = myled3 = 1;
+    float vrijeme = 1;
     while(1) {
-        myled = 0;
-        wait(vrijeme1);
-        myled = 1;
-        vrijeme1 += f * 0.03;
-        wait(vrijeme2);
-        
-        vrijeme2 -= f * 0.03;
-        
-        if(vrijeme1 >= 1.9 )
-        f *= -1;
-        else if (vrijeme2 >= 1.9 )
-        f *= -1;
+        myled1 = 0;
+        wait(vrijeme);
+        myled1 = 1;
+        myled2 = 0;
+        wait(vrijeme);
+        myled2 = 1;
+        myled3 = 0;
+        wait(vrijeme);
+        myled3 = 1;
+        if(vrijeme > 0.1)
+        vrijeme -= 0.1;
     }
 }