William Singleton / Mbed 2 deprecated 595_Lab_8_Part_I_Thread

Dependencies:   mbed mbed-rtos

Files at this revision

API Documentation at this revision

Comitter:
wssingle
Date:
Sun May 03 19:09:23 2020 +0000
Parent:
12:4e3f46e615d9
Commit message:
Part one of Lab 8 (595)

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Mar 30 18:54:14 2020 +0000
+++ b/main.cpp	Sun May 03 19:09:23 2020 +0000
@@ -0,0 +1,22 @@
+#include "mbed.h"
+#include "rtos.h"
+ 
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+Thread thread;
+ 
+void led2_thread() {
+    while (true) {
+        led2 = !led2;
+        Thread::wait(1000);
+    }
+}
+ 
+int main() {
+    thread.start(led2_thread);
+    
+    while (true) {
+        led1 = !led1;
+        Thread::wait(500);
+    }
+}
\ No newline at end of file