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.
main.cpp
- Committer:
- dafemon
- Date:
- 2021-09-27
- Revision:
- 0:71cf903a125d
File content as of revision 0:71cf903a125d:
#include "mbed.h"
#include "rtos.h"
Serial pc(USBTX, USBRX);// declaracion de puerto serial
//declaracion de puertos
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
//Declaracion de las tareas
Thread t1;
Thread t2;
Thread t3;
Thread t4;
Thread t5;
Thread t6;
Thread t7;
Thread t8;
Thread t9;
Thread t10;
Thread t11;
Mutex m;
//asignacion de las tareas
void tarea1() {
while (true) {
led2 = !led2;
led3=1;
Thread::wait(1000); // tiempo de espera
printf("tarea 1 \n\r"); // impresion
}
}
void tarea2() {
while (true) {
led3 =0;
Thread::wait(2000); //tiempo de espera
printf("tarea 2 \n\r"); //impresion
}
}
void tarea3() {
m.lock();
while (true) {
led1 = !led1;
Thread::wait(3000); //tiempo de espera
printf("tarea 3 \n\r"); // impresion
}
}
void tarea4() {
while (true) {
//led1 = !led1;
Thread::wait(3000); //tiempo de espera
printf("tarea 4 \n\r"); // impresion
}
}
void tarea5() {
while (true) {
//led1 = !led1;
Thread::wait(1500); //tiempo de espera
printf("tarea 5 \n\r"); // impresion
}
}
void tarea6() {
while (true) {
//led1 = !led1;
Thread::wait(1500); //tiempo de espera
printf("tarea 6 \n\r"); // impresion
}
}
void tarea7() {
while (true) {
//led1 = !led1;
Thread::wait(1500); //tiempo de espera
printf("tarea 7 \n\r"); // impresion
}
}
void tarea8() {
while (true) {
//led1 = !led1;
Thread::wait(1500); //tiempo de espera
printf("tarea 8 \n\r"); // impresion
}
}
void tarea9() {
while (true) {
//led1 = !led1;
Thread::wait(1500); //tiempo de espera
printf("tarea 9 \n\r"); // impresion
}
}
void tarea10() {
while (true) {
//led1 = !led1;
Thread::wait(1500); //tiempo de espera
printf("tarea 10 \n\r"); // impresion
}
}
void tarea11() {
while (true) {
//led1 = !led1;
Thread::wait(1500); //tiempo de espera
printf("tarea 11 \n\r"); // impresion
}
}
int main() {
printf("Hola Mundo \n\r");
pc.baud(9600);
//inicializacion de ls tareas
t5.start(tarea5);
t1.start(tarea1);
t2.start(tarea2);
t3.start(tarea3);
t4.start(tarea4);
t5.start(tarea5);
t6.start(tarea6);
t7.start(tarea7);
t8.start(tarea8);
t9.start(tarea9);
t10.start(tarea10);
t11.start(tarea11);
//t1.terminate();
//tipo de prioridad
//Thread t5(osPriorityNormal);
Thread t1(osPriorityBelowNormal);
Thread t2(osPriorityNormal);
Thread t3(osPriorityAboveNormal);
Thread t4(osPriorityAboveNormal);
Thread t5(osPriorityBelowNormal);
Thread t6(osPriorityBelowNormal);
Thread t7(osPriorityBelowNormal);
Thread t8(osPriorityBelowNormal);
Thread t9(osPriorityBelowNormal);
Thread t10(osPriorityBelowNormal);
Thread t11(osPriorityBelowNormal);
while (true) {
}
}