experiment_with_rtos

Dependencies:   mbed-rtos mbed

Fork of rtos_basic by Mbed

Files at this revision

API Documentation at this revision

Comitter:
foivosHrist
Date:
Thu Oct 09 23:14:12 2014 +0000
Parent:
6:209f4db62daf
Commit message:
experiment code

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 16:01:32 2013 +0100
+++ b/main.cpp	Thu Oct 09 23:14:12 2014 +0000
@@ -1,21 +1,36 @@
 #include "mbed.h"
 #include "rtos.h"
- 
-DigitalOut led1(LED1);
+//#include <string>
+
 DigitalOut led2(LED2);
+Serial pc(USBTX, USBRX);
+
+//string mes;
+
+struct argStruct{
+    int delay;
+    int message;
+}initArgs;
  
+ 
+ //--------------------------------
 void led2_thread(void const *args) {
+    
+    argStruct* rcvArgs=(argStruct*)args;
+    pc.printf("delay=%d message=%d\n",rcvArgs->delay,rcvArgs->message);
     while (true) {
         led2 = !led2;
-        Thread::wait(1000);
+        Thread::wait(rcvArgs->delay);
     }
 }
- 
+//---------------------------------- 
 int main() {
-    Thread thread(led2_thread);
+    pc.printf("START!\n");
+    initArgs.delay=300;
+    initArgs.message=111;
     
-    while (true) {
-        led1 = !led1;
-        Thread::wait(500);
+    //led2_thread(&initArgs);   //<--this instead of the below line works fine
+    Thread thread(led2_thread,&initArgs);  
+    pc.printf("END!\n");
+
     }
-}
--- a/mbed-rtos.lib	Tue Jun 04 16:01:32 2013 +0100
+++ b/mbed-rtos.lib	Thu Oct 09 23:14:12 2014 +0000
@@ -1,1 +1,1 @@
-https://mbed.org/users/mbed_official/code/mbed-rtos/
\ No newline at end of file
+https://mbed.org/users/mbed_official/code/mbed-rtos/#631c0f1008c3
--- a/mbed.bld	Tue Jun 04 16:01:32 2013 +0100
+++ b/mbed.bld	Thu Oct 09 23:14:12 2014 +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/552587b429a1
\ No newline at end of file