ferney alberto beltran molina
/
TimerE3RTOS
EJEMPLO3
Diff: main.cpp
- Revision:
- 0:a550aef65fac
- Child:
- 1:0f682b1c98ec
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Oct 28 01:54:47 2017 +0000 @@ -0,0 +1,39 @@ +#include "mbed.h" + + +Ticker tk1; +Ticker tk2; +DigitalOut output1(LED1); // digital output +Serial serial(USBTX, USBRX); + + +void task1(void); // task function prototype +void task2(void); // task function prototype + + + +//*** main code + +void main() { + output1=0; + tk1.attach(&task1, 0.8); + tk2.attach(&task2, 0.6); + while(1) { + wait_ms(2000); + output1=!output1; // toggle output + } + } +void task1(void){ // task function + + serial.printf("hola soy task1\n"); + wait_ms(300); + + +} + +void task2(void){ // task function + + serial.printf("hola soy task2\n"); + wait_ms(300); + +} \ No newline at end of file