mbed RTOS Basic

Files at this revision

API Documentation at this revision

Comitter:
rkuo2000
Date:
Thu Oct 20 12:19:56 2016 +0000
Commit message:
mbed RTOS basic (thread)

Changed in this revision

.gitignore Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r be1314d845cf .gitignore
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.gitignore	Thu Oct 20 12:19:56 2016 +0000
@@ -0,0 +1,4 @@
+.build
+.mbed
+projectfiles
+*.py*
diff -r 000000000000 -r be1314d845cf main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Oct 20 12:19:56 2016 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+#include "rtos.h"
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+
+void led2_thread(void const *args) {
+    while (true) {
+        led2 = !led2;
+        Thread::wait(1000);
+    }
+}
+ 
+int main() {
+    Thread thread(led2_thread);
+    
+    while (true) {
+        led1 = !led1;
+        Thread::wait(500);
+    }
+}
diff -r 000000000000 -r be1314d845cf mbed-os.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Thu Oct 20 12:19:56 2016 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#a6f3fd1a60d5df59246d7caf3f108c4d34e1808e