Blink using threads

Revision:
0:f6371c0a2f6f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 08 12:37:42 2018 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+Thread thread;
+
+void led2_thread() {
+    while (true) {
+        led2 = !led2;
+        wait(1);
+    }
+}
+
+int main() {
+    // Create a thread to execute the function led2_thread
+    thread.start(led2_thread);
+    // Now led2_thread is executing concurrently with main at this point
+
+    while (true) {
+        led1 = !led1;
+        wait(0.5);
+    }
+}
\ No newline at end of file