2 flags with comments

Dependencies:   mbed-rtos mbed

Fork of rtos_signals by mbed official

Files at this revision

API Documentation at this revision

Comitter:
cathal66
Date:
Fri Feb 13 14:36:56 2015 +0000
Parent:
3:c133402c77cb
Commit message:
comments added with 2 flags

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Jun 04 15:54:12 2013 +0100
+++ b/main.cpp	Fri Feb 13 14:36:56 2015 +0000
@@ -1,21 +1,25 @@
 #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(0x2);           //Wait for flag to be set after thread wait for 2000 msec
+        led = 0.5;                          //dim LED to half brightness
+        Thread::signal_wait(0x1);           //Wait for flag to be set after thread wait for 100 msec
+        led = 1;                            //turn off 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"
+        Thread::wait(2000);                 //Thread wait for 2000 msec
+        thread.signal_set(0x2);             //set the flag for "0x2
     }
 }
--- a/mbed-rtos.lib	Tue Jun 04 15:54:12 2013 +0100
+++ b/mbed-rtos.lib	Fri Feb 13 14:36:56 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed-rtos/#83e169389a69
--- a/mbed.bld	Tue Jun 04 15:54:12 2013 +0100
+++ b/mbed.bld	Fri Feb 13 14:36:56 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa
\ No newline at end of file