basic with comments

Dependencies:   mbed-rtos mbed

Fork of Case_Study_rtos_signals by cathal deehy-power

Revision:
1:6a8fcc666593
Parent:
0:19f3d184e2ea
Child:
4:3925b40d3296
Child:
5:47c0e14dbd4a
--- a/main.cpp	Fri Jul 13 10:55:48 2012 +0000
+++ b/main.cpp	Fri Jul 13 10:58:06 2012 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+#include "rtos.h"
+
+DigitalOut led(LED1);
+
+void led_thread(void const *argument) {
+    while (true) {
+        // Signal flags that are reported as event are automatically cleared.
+        Thread::signal_wait(0x1);
+        led = !led;
+    }
+}
+
+int main (void) {
+    Thread thread(led_thread);
+    
+    while (true) {
+        Thread::wait(1000);
+        thread.signal_set(0x1);
+    }
+}