running on mbed now

Dependencies:   Classic_PID iC_MU mbed-rtos mbed

Revision:
0:3a132f85c1a8
Child:
1:0f0423207b62
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Mar 22 08:33:17 2016 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+
+DigitalOut myled(LED1);
+Serial pc (USBTX,USBRX);
+Timer t;
+
+int main()
+{
+    float run_time = 5.0;
+    float start_Hz = 1.0, stop_Hz = 2.0;
+    float amplitude;
+    
+
+    pc.printf("\n\r Enter Start frequency (Hz): ");
+    pc.scanf("%f", &start_Hz);
+    pc.printf("%f",start_Hz);
+    
+    pc.printf("\n\r Enter Stop frequency (Hz): ");
+    pc.scanf("%f", &stop_Hz);
+    pc.printf("%f",stop_Hz);
+    
+    pc.printf("\n\r Enter Amplitude (encoder counts): ");
+    pc.scanf("%f", &amplitude);
+    pc.printf("%f",amplitude);
+    
+    pc.printf("\n\n\r Press any key to start test...");
+    pc.getc();
+    
+    float w1 = start_Hz * 3.14159 * 2;
+    float w2 = stop_Hz * 3.14159 * 2; 
+    float a = (w2 - w1) / (2 * run_time); 
+    float b = w1;    
+    float now;
+       
+    t.start();
+
+    while(t.read() < run_time) {
+        now = t.read();
+        pc.printf("\n\r%f",amplitude * sin((a*now*now)+(b*now)));
+    }
+
+}