Rolando Pelayo / Mbed 2 deprecated sine_wave_generator

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
roland_tmm
Date:
Tue Nov 21 19:57:07 2017 +0000
Parent:
2:602f7589c53e
Commit message:
Edited main.cpp: corrected multi-threading error

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 602f7589c53e -r f7923b9e8611 main.cpp
--- a/main.cpp	Tue Nov 21 19:18:25 2017 +0000
+++ b/main.cpp	Tue Nov 21 19:57:07 2017 +0000
@@ -13,7 +13,8 @@
 double DDStrimFreq = 124999500;    //frequency used by AD9850 to calibrate
 int DDSphase = 0;                  //phase for the AD9850
 
-Thread thread;                   //create thread to allow simultaneous LED blink and DDS output
+Thread GENthread;                   //create thread to allow simultaneous LED blink and DDS output
+Thread LEDthread; 
 
 //AD9833 LED thread
 void GENBlinkThread() {
@@ -37,8 +38,8 @@
 
 int main() { 
 
-    thread.start(callback(GENBlinkThread));
-    thread.start(callback(DDSBlinkThread));
+    GENthread.start(callback(GENBlinkThread));
+    LEDthread.start(callback(DDSBlinkThread));
    
     // Sequence to follow to generate waveform using AD9833
     gen.Begin();              // The loaded defaults are 1000 Hz SINE_WAVE using REG0
@@ -54,5 +55,7 @@
     dds.CalibrateDDS(DDStrimFreq);       //calibrate to match crystal oscillator
     dds.SetDDSFrequency(DDSfreq, DDSphase);
     
+    GENthread.join();                   //wait for the threads to finish
+    LEDthread.join();
     while(1);
 }