MII1SistElec
/
PR2EJ9
practica 2 ejercicio 9
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "rtos.h" 00003 00004 DigitalIn Sw(A5); 00005 DigitalOut Led(D4); 00006 int estado=1; 00007 00008 void threadled(void const *argument) 00009 { 00010 while (1) { 00011 Thread::signal_wait(0x1); 00012 Led = !Led; 00013 00014 } 00015 } 00016 00017 int main() 00018 { 00019 Thread thread(threadled, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); 00020 00021 while (true) { 00022 if (estado&&(!Sw)) { 00023 thread.signal_set(0x1); 00024 } 00025 estado=Sw; 00026 Thread::wait(200); 00027 } 00028 }
Generated on Wed Jul 13 2022 13:26:58 by 1.7.2