Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of VTMatija_Berecek by
main.cpp
00001 #include "mbed.h" 00002 Timer timer1 ; // define timer object 00003 Timer timer2; 00004 DigitalOut output1(p5); // digital output 00005 DigitalOut output2(p6); 00006 void task1(void); // task function prototype 00007 void task2(void); 00008 //*** main code 00009 int main() { 00010 timer1.start(); // start timer1 counting 00011 timer2.start(); // start timer2 counting 00012 while(1) { 00013 if (timer1.read_ms()>=200) // read time 00014 { 00015 task1(); // call task1 function 00016 timer1.reset(); // reset timer 00017 } 00018 if (timer2.read_ms()>=1000) // read time 00019 { 00020 task2(); // call task2 function 00021 timer2.reset(); // reset timer 00022 } 00023 } 00024 } 00025 //*** task functions 00026 void task1(void){ 00027 output1=!output1; // toggle output1 00028 } 00029 void task2(void){ 00030 output2=!output2; // toggle output2 00031 }
Generated on Thu Jul 21 2022 15:57:16 by
1.7.2
