basic with comments

Dependencies:   mbed-rtos mbed

Fork of Case_Study_rtos_signals by cathal deehy-power

Revision:
5:47c0e14dbd4a
Parent:
1:6a8fcc666593
--- a/main.cpp	Tue Jun 04 15:54:12 2013 +0100
+++ b/main.cpp	Fri Feb 13 14:41:31 2015 +0000
@@ -1,21 +1,22 @@
 #include "mbed.h"
 #include "rtos.h"
 
-DigitalOut led(LED1);
+PwmOut led(p25);                            //setup LED for PWM
 
 void led_thread(void const *argument) {
     while (true) {
         // Signal flags that are reported as event are automatically cleared.
-        Thread::signal_wait(0x1);
-        led = !led;
+        Thread::signal_wait(0x1);           //Wait for flag "0x1" to be set after thread wait for 1000 msec
+        led = !led;                          //toggle the LED
     }
 }
 
 int main (void) {
-    Thread thread(led_thread);
+    Thread thread(led_thread);              //start thread
     
     while (true) {
-        Thread::wait(1000);
-        thread.signal_set(0x1);
+        Thread::wait(1000);                 //thread wait for 1000 msec
+        thread.signal_set(0x1);             //set the flag for "0x1"
+
     }
 }