Ovo je vježba 1.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
JosipLupinski
Date:
Wed Oct 19 17:29:25 2016 +0000
Parent:
0:0aec5080d68b
Commit message:
Ovo je vje?ba 1, recimo da je do 5. zadatka.

Changed in this revision

HelloWorld.cpp Show annotated file Show diff for this revision Revisions of this file
Led1Led2blinky.cpp Show annotated file Show diff for this revision Revisions of this file
T_TOTALndT_FLASH.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show diff for this revision Revisions of this file
diff -r 0aec5080d68b -r 77097e35c855 HelloWorld.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HelloWorld.cpp	Wed Oct 19 17:29:25 2016 +0000
@@ -0,0 +1,13 @@
+#include "mbed.h"
+ 
+DigitalOut myled(LED1);
+ 
+int main() {
+    while(1) {
+        myled = 1;
+        wait(0.2);
+        myled = 0;
+        wait(0.2);
+    }
+}
+
diff -r 0aec5080d68b -r 77097e35c855 Led1Led2blinky.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Led1Led2blinky.cpp	Wed Oct 19 17:29:25 2016 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+
+DigitalOut myled1(LED1);
+DigitalOut myled2(LED2);
+
+
+int main() {
+    
+
+        while(true){
+            for(int i=0; i<=3;i++){
+                myled1=1;
+                wait(0.5);
+                myled1=0;
+                wait(0.5);
+                
+            }
+            for(int j=0; j<=3;j++){
+                myled2=1;
+                wait(0.5);
+                myled2=0;
+                wait(0.5);
+                
+            }
+        }
+    
+}
\ No newline at end of file
diff -r 0aec5080d68b -r 77097e35c855 T_TOTALndT_FLASH.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/T_TOTALndT_FLASH.cpp	Wed Oct 19 17:29:25 2016 +0000
@@ -0,0 +1,34 @@
+#include "mbed.h"
+
+DigitalOut myled1(LED1);
+DigitalOut myled2(LED2);
+
+const float T_TOTAL=10;
+const float T_FLASH=0.2;
+
+int main() {
+    
+    float T_CALC;
+    
+    T_CALC = T_TOTAL / (2 * T_FLASH);
+    
+    while(true){
+        
+        for(float i=1; i<=T_CALC;i++){
+                myled1=1;
+                wait(T_FLASH);
+                myled1=0;
+                wait(T_FLASH);
+                
+            }
+            for(float j=1; j<=T_CALC;j++){
+                myled2=1;
+                wait(T_FLASH);
+                myled2=0;
+                wait(T_FLASH);
+                
+            }
+    
+    }
+
+}
diff -r 0aec5080d68b -r 77097e35c855 main.cpp
--- a/main.cpp	Wed Oct 19 17:24:57 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#include "mbed.h"
-
-DigitalOut myled1(LED1);
-DigitalOut myled2(LED2);
-
-
-int main() {
-    
-
-        while(true){
-            for(int i=0; i<=3;i++){
-                myled1=1;
-                wait(0.5);
-                myled1=0;
-                wait(0.5);
-                
-            }
-            for(int j=0; j<=3;j++){
-                myled2=1;
-                wait(0.5);
-                myled2=0;
-                wait(0.5);
-                
-            }
-        }
-    
-}
\ No newline at end of file