report

Dependencies:   ADXL362 Lab7 mbed

Revision:
1:ed3c12662b08
Parent:
0:db770a1bef64
Child:
3:5f7286858dd0
--- a/main.cpp	Fri Feb 02 15:03:02 2018 +0000
+++ b/main.cpp	Fri Feb 02 23:05:39 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)
@@ -167,6 +169,6 @@
         else if (strstr(s_one, "SINE") != NULL){
             sinecom(s_two);
             }
-        else pc.printf("Bad command, try again buddy \n\r");      
+        else pc.printf("Bad command, try again buddy \n\r");         
         }
 }
\ No newline at end of file