LED with mutex protect

Dependencies:   C12832 LM75B mbed-rtos mbed

Fork of Case_Study_rtos_basic_Mutex_LED by cathal deehy-power

Revision:
7:10edddb7f1a8
Parent:
3:c92e21f305d8
Child:
8:0f773a5937f0
--- a/main.cpp	Tue Jun 04 16:01:32 2013 +0100
+++ b/main.cpp	Thu Feb 12 22:54:35 2015 +0000
@@ -1,21 +1,21 @@
-#include "mbed.h"
-#include "rtos.h"
+#include "mbed.h"                       //Include the mbed.h file   
+#include "rtos.h"                       //include the RTOS.h file
  
-DigitalOut led1(LED1);
-DigitalOut led2(LED2);
+DigitalOut led1(LED1);                  //Setup LED1 to the varible name led1
+DigitalOut led2(LED2);                  //Setup LED2 to the varible name led2
  
-void led2_thread(void const *args) {
-    while (true) {
-        led2 = !led2;
-        Thread::wait(1000);
-    }
-}
+void led2_thread(void const *args) {    //Function or the thread to be called
+    while (true) {                      //Super loop
+        led2 = !led2;                   //Toggle led2
+        Thread::wait(1000);             //Thread wait 1 sec
+    }                                   //End Super loop
+}                                       //End Function / thread
  
-int main() {
-    Thread thread(led2_thread);
+int main() {                            //Main
+    Thread thread(led2_thread);         //Setup led2_thread as a thread with the name "thread"
     
-    while (true) {
-        led1 = !led1;
-        Thread::wait(500);
-    }
-}
+    while (true) {                      //Super loop
+        led1 = !led1;                   //Toggle led1
+        Thread::wait(500);              //thread wait 500msec
+    }                                   //End super loop
+}                                       //End main