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
00001 #include "mbed.h" 00002 #include "rtos.h" 00003 Serial pc(USBTX, USBRX);// declaracion de puerto serial 00004 00005 //declaracion de puertos 00006 DigitalOut led1(LED1); 00007 DigitalOut led2(LED2); 00008 DigitalOut led3(LED3); 00009 //Declaracion de las tareas 00010 Thread t1; 00011 Thread t2; 00012 Thread t3; 00013 Thread t4; 00014 Thread t5; 00015 Thread t6; 00016 Thread t7; 00017 Thread t8; 00018 Thread t9; 00019 Thread t10; 00020 Thread t11; 00021 00022 00023 Mutex m; 00024 //asignacion de las tareas 00025 void tarea1() { 00026 while (true) { 00027 led2 = !led2; 00028 led3=1; 00029 Thread::wait(1000); // tiempo de espera 00030 printf("tarea 1 \n\r"); // impresion 00031 } 00032 } 00033 00034 void tarea2() { 00035 while (true) { 00036 led3 =0; 00037 Thread::wait(2000); //tiempo de espera 00038 printf("tarea 2 \n\r"); //impresion 00039 } 00040 } 00041 00042 void tarea3() { 00043 m.lock(); 00044 while (true) { 00045 led1 = !led1; 00046 Thread::wait(3000); //tiempo de espera 00047 printf("tarea 3 \n\r"); // impresion 00048 } 00049 } 00050 void tarea4() { 00051 while (true) { 00052 //led1 = !led1; 00053 Thread::wait(3000); //tiempo de espera 00054 printf("tarea 4 \n\r"); // impresion 00055 } 00056 } 00057 void tarea5() { 00058 while (true) { 00059 //led1 = !led1; 00060 Thread::wait(1500); //tiempo de espera 00061 printf("tarea 5 \n\r"); // impresion 00062 } 00063 } 00064 void tarea6() { 00065 while (true) { 00066 //led1 = !led1; 00067 Thread::wait(1500); //tiempo de espera 00068 printf("tarea 6 \n\r"); // impresion 00069 } 00070 } 00071 void tarea7() { 00072 while (true) { 00073 //led1 = !led1; 00074 Thread::wait(1500); //tiempo de espera 00075 printf("tarea 7 \n\r"); // impresion 00076 } 00077 } 00078 void tarea8() { 00079 while (true) { 00080 //led1 = !led1; 00081 Thread::wait(1500); //tiempo de espera 00082 printf("tarea 8 \n\r"); // impresion 00083 } 00084 } 00085 void tarea9() { 00086 while (true) { 00087 //led1 = !led1; 00088 Thread::wait(1500); //tiempo de espera 00089 printf("tarea 9 \n\r"); // impresion 00090 } 00091 } 00092 void tarea10() { 00093 while (true) { 00094 //led1 = !led1; 00095 Thread::wait(1500); //tiempo de espera 00096 printf("tarea 10 \n\r"); // impresion 00097 } 00098 } 00099 void tarea11() { 00100 while (true) { 00101 //led1 = !led1; 00102 Thread::wait(1500); //tiempo de espera 00103 printf("tarea 11 \n\r"); // impresion 00104 } 00105 } 00106 00107 int main() { 00108 printf("Hola Mundo \n\r"); 00109 00110 pc.baud(9600); 00111 00112 //inicializacion de ls tareas 00113 t5.start(tarea5); 00114 t1.start(tarea1); 00115 t2.start(tarea2); 00116 t3.start(tarea3); 00117 t4.start(tarea4); 00118 t5.start(tarea5); 00119 t6.start(tarea6); 00120 t7.start(tarea7); 00121 t8.start(tarea8); 00122 t9.start(tarea9); 00123 t10.start(tarea10); 00124 t11.start(tarea11); 00125 //t1.terminate(); 00126 00127 //tipo de prioridad 00128 //Thread t5(osPriorityNormal); 00129 Thread t1(osPriorityBelowNormal); 00130 Thread t2(osPriorityNormal); 00131 Thread t3(osPriorityAboveNormal); 00132 Thread t4(osPriorityAboveNormal); 00133 Thread t5(osPriorityBelowNormal); 00134 Thread t6(osPriorityBelowNormal); 00135 Thread t7(osPriorityBelowNormal); 00136 Thread t8(osPriorityBelowNormal); 00137 Thread t9(osPriorityBelowNormal); 00138 Thread t10(osPriorityBelowNormal); 00139 Thread t11(osPriorityBelowNormal); 00140 while (true) { 00141 00142 } 00143 }
Generated on Sun Oct 2 2022 17:33:56 by
1.7.2