Testing thread in mbed.

Dependencies:   mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
akverma
Date:
Sat Dec 03 07:25:30 2016 +0000
Commit message:
Basic thread implementation using RTOS.

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Dec 03 07:25:30 2016 +0000
@@ -0,0 +1,26 @@
+#include "mbed.h"
+#include "rtos.h"
+ 
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+ 
+void led2_thread(void const *args) {
+    int i=0;
+    while (i<4) {
+        led2 = !led2;
+        Thread::wait(1000);
+        i++;
+    }
+}
+ 
+int main() {
+    led1 = 1;
+    led2 = 1;
+    uint8_t data[3] = {0x47, 0x32, 0xA7};
+    Thread thread(led2_thread);
+    
+    while (true) {
+        led1 = !led1;
+        Thread::wait(500);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Sat Dec 03 07:25:30 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#58563e6cba1e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Dec 03 07:25:30 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/d75b3fe1f5cb
\ No newline at end of file