Enil Pajić Aida Pločo

Dependencies:   mbed

Fork of LV1_G1_Tim007_Zad2 by tim007 tim007

Revision:
0:5fd44252399a
Child:
1:febbb2498efa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Mar 03 07:37:49 2014 +0000
@@ -0,0 +1,36 @@
+#include "mbed.h"
+ 
+DigitalOut myled(LED2);
+ 
+int main() {
+    while(1) {
+        myled = 0;
+        wait(1);
+        myled = 1;
+        wait(1);
+        const double e = 0.9/30.0;
+        double f = 1 + e;               // 1.03
+        double h = 1 - e;               // 1 - 0.03
+        for (int a = 0; a < 30; ++a)
+            {
+                myled = 0;              // Ukljucena
+                wait (f);               // za 1.03 pa 1.06, 1.09 ... pa 1.9
+                f += e;
+                myled = 1;              // Iskljucena
+                wait (h);               // za 0.97, pa 0.94 ... pa 0.1
+                h -= e;
+            }
+        f = 1 - e;
+        h = 1 + e;
+        for (int a = 0; a < 60; ++a)
+            {
+                myled = 0;
+                wait (f);
+                f -= e;
+                myled = 1;
+                wait (h);
+                h += e;
+ 
+            }
+    }
+}
\ No newline at end of file