kol

Dependencies:   mbed

Revision:
0:5827fd72218f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 09 13:47:06 2017 +0000
@@ -0,0 +1,30 @@
+#include "mbed.h"
+#include "rtos.h"
+ 
+DigitalIn myswitch1(A5);
+DigitalOut myled1(D4);
+int estadoled1=1;
+ 
+void thread_led1(void const *argument)
+{
+    while (1) {
+        Thread::signal_wait(0x1);
+        myled1 = !myled1;
+ 
+    }
+}
+ 
+int main()
+{
+    Thread thread(thread_led1, NULL, osPriorityNormal, DEFAULT_STACK_SIZE);
+ 
+    while (true) {
+        if (estadoled1&&(!myswitch1)) {
+            thread.signal_set(0x1);
+            //thread.start(thread_led1);
+ 
+        }
+        estadoled1=myswitch1;
+        Thread::wait(200);
+    }
+}
\ No newline at end of file