compartido
/
PR2EJER7
practica2ejercicio7
Fork of PR2EJ7 by
Diff: main.cpp
- Revision:
- 2:150c7630f878
- Parent:
- 1:ee5228330793
diff -r ee5228330793 -r 150c7630f878 main.cpp --- a/main.cpp Mon Nov 06 17:06:51 2017 +0000 +++ b/main.cpp Mon Nov 06 17:07:57 2017 +0000 @@ -5,26 +5,26 @@ DigitalOut Led2(PB_5); // Led2 conectado al pin D4 DigitalOut Led3(PB_4); // Led3 conectado al pin D5 - - -void blink1(void const *argument) { -while (1) { +void blink1(void const *argument) +{ + while (1) { Led1 = !Led1; //cambiar el Led de estado Thread::wait(1000); //tiempo de espera para cambiar el led1 de estado } - } - +} -void blink2(void const *argument) { -while (1) { - Led2 = !Led2; //cambiar el Led de estado +void blink2(void const *argument) +{ + while (1) { + Led2 = !Led2; //cambiar el Led de estado Thread::wait(1200); //tiempo de espera para cambiar el led2 de estado } } -void blink3(void const *argument) { +void blink3(void const *argument) +{ -while (1) { + while (1) { Led3 = !Led3; //cambiar el Led de estado Thread::wait(1500); //tiempo de espera para cambiar el led3 de estado } @@ -32,12 +32,12 @@ int main() { -Thread thread1(blink1, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); //forma apropiada de llamar a los Thread -Thread thread2(blink2, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); -Thread thread3(blink3, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); -while (true) { //código para que el programa no acabe y los Thread sigan ejecutándose - - Thread::wait(500); + Thread thread1(blink1, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); //forma apropiada de llamar a los Thread + Thread thread2(blink2, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); + Thread thread3(blink3, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); + while (true) { //código para que el programa no acabe y los Thread sigan ejecutándose + + Thread::wait(500); } -} +} \ No newline at end of file