Dva tajmera 6-2

Dependencies:   mbed

Revision:
0:f25029cd4ab4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Dec 17 15:02:09 2015 +0000
@@ -0,0 +1,34 @@
+#include "mbed.h"
+
+
+Timer timer1; // define timer object
+Timer timer2; 
+DigitalOut output1(p5); // digital output
+DigitalOut output2(p5);
+void task1(void); // task function prototype 
+void task2(void);
+
+
+int main() {
+        timer1.start(); // start timer1 counting
+        timer2.start(); // start timer2 counting
+    while(1) {
+        if (timer1.read_ms()>=200) // read time
+        {
+        task1(); // call task1 function
+        timer1.reset(); // reset timer
+        }
+        if (timer2.read_ms()>=1000) // read time
+        {
+        task2(); // call task2 function
+        timer2.reset(); // reset timer
+        }
+    }
+}
+//*** task functions
+void task1(void){
+ output1=!output1; // toggle output1
+}
+void task2(void){
+ output2=!output2; // toggle output2
+} 
\ No newline at end of file