3rd lab

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
dprowe
Date:
Fri Feb 02 18:00:06 2018 +0000
Parent:
0:904d2d8522b1
Commit message:
tHE THIRD LAB

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Feb 02 01:40:26 2018 +0000
+++ b/main.cpp	Fri Feb 02 18:00:06 2018 +0000
@@ -54,13 +54,15 @@
     pc.printf("Frequency: %f \n\r",input_f);
 
     float wait_time = -9.955923 + (20817940 + 9.955923) / (1 + powf(input_f/0.0007111212, 1.049561));  //took data points and got this equation by estimating the graph with computer, results in 1-3% error
-    while(1) {      
+    
+    while(!pc.readable()) {      
         // sinewave output
         for (int i = 0; i < BUFFER_SIZE; i++) {
             Vout.write_u16(buffer[i]/(3.30 * (1.00/inV)));
-            wait_us(wait_time);
+            wait_us((int)wait_time);
         }
     }
+    return;
 }
 
 void ledcom(char* onoff)