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
main.cpp
- Committer:
- imihalj
- Date:
- 2016-11-10
- Revision:
- 6:ca9ae5ce232d
- Parent:
- 5:94aa173f182c
- Child:
- 7:c56b212b084e
File content as of revision 6:ca9ae5ce232d:
#include "mbed.h" Timer timer1; // define timer object Timer timer2; // define timer object DigitalOut output1(p5); // digital output DigitalOut output2(p6); // digital output void task1(void); // task function prototype void task2(void); // task function prototype 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 }