Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Task612-mbedos54 by
Diff: main.cpp
- Revision:
- 1:fdf9ceb4a107
- Parent:
- 0:69af4e3595b6
- Child:
- 2:410eacc3006a
--- a/main.cpp	Tue Mar 08 11:46:22 2016 +0000
+++ b/main.cpp	Thu Mar 30 13:47:29 2017 +0000
@@ -1,14 +1,13 @@
 #include "mbed.h"
-#include "rtos.h"
 
 #define RED_TOGGLE    1
 #define YELLOW_TOGGLE 2
 #define GREEN_TOGGLE  4
 
 //Function declarations
-void FunctionRed(void const *args);
-void FunctionYellow(void const *args);
-void FunctionGreen(void const *args);
+void FunctionRed();
+void FunctionYellow();
+void FunctionGreen();
 
 //I/O
 DigitalOut onBoardLED(LED1);
@@ -22,7 +21,7 @@
 
 
 //Each of the following 3 functions is listening for a signal
-void FunctionRed(void const *args)
+void FunctionRed()
 {
     while (true) {
         Thread::signal_wait(RED_TOGGLE);  
@@ -30,7 +29,7 @@
     }
 }
 
-void FunctionYellow(void const *args)
+void FunctionYellow()
 {
     while (true) {
         Thread::signal_wait(YELLOW_TOGGLE);
@@ -38,7 +37,7 @@
     }
 }
 
-void FunctionGreen(void const *args)
+void FunctionGreen()
 {
     while (true) {
         Thread::signal_wait(GREEN_TOGGLE);
@@ -52,10 +51,15 @@
     yellowLED = 0;
     greenLED  = 0;
         
-    //Create and run threads
-    Thread t1(FunctionRed);           
-    Thread t2(FunctionYellow);    
-    Thread t3(FunctionGreen);   
+    //Create threads
+    Thread t1;           
+    Thread t2;    
+    Thread t3;   
+    
+    //Start threads
+    t1.start(FunctionRed);           
+    t2.start(FunctionYellow);    
+    t3.start(FunctionGreen);      
     
     //Main loop
     while(1) {
    