practica 2 ejercicio 9

Dependencies:   mbed-rtos mbed

Revision:
0:f2a8b489600e
Child:
1:bfed5e20331a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 09 14:03:51 2017 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+#include "rtos.h"
+
+DigitalIn Sw(A5);
+DigitalOut Led(D4);
+int estado=1;
+
+void threadled(void const *argument)
+{
+    while (1) {
+        Thread::signal_wait(0x1);
+        Led = !Led;
+
+    }
+}
+
+int main()
+{
+    Thread thread(threadled, NULL, osPriorityNormal, DEFAULT_STACK_SIZE);
+
+    while (true) {
+        if (estado&&(!Sw)) {
+            thread.signal_set(0x1);
+            //thread.start(thread_led1);
+        }
+        Led=Sw;
+        Thread::wait(200);
+    }
+}
\ No newline at end of file