Blink two LEDs using RTOS

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
roland_tmm
Date:
Tue Nov 21 20:12:41 2017 +0000
Commit message:
Test LED blink program for sine wave generator

Changed in this revision

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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 390b0a20e899 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Nov 21 20:12:41 2017 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+
+DigitalOut GENLED(PC_7);         //LED for AD9833 output
+DigitalOut DDSLED(PC_13);        //LED for AD9850 output
+
+Thread GENthread;                   //create thread to allow simultaneous LED blink and DDS output
+Thread LEDthread; 
+
+//AD9833 LED thread
+void GENBlinkThread() {
+    while (true) {
+        GENLED = !GENLED;
+        Thread::wait(1000);     
+    }
+}
+
+//AD9850 LED thread
+void DDSBlinkThread() {
+    while (true) {
+        DDSLED = !DDSLED;
+        Thread::wait(500);
+    }
+}
+
+int main() {
+    GENthread.start(callback(GENBlinkThread));
+    LEDthread.start(callback(DDSBlinkThread));
+    
+    GENthread.join();                   //wait for the threads to finish
+    LEDthread.join();
+   
+    while(1);
+}
diff -r 000000000000 -r 390b0a20e899 mbed-os.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Tue Nov 21 20:12:41 2017 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#c9e63f14085f5751ff5ead79a7c0382d50a813a2
diff -r 000000000000 -r 390b0a20e899 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Nov 21 20:12:41 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e7ca05fa8600
\ No newline at end of file