Tests the motor by having the speed follow a sine wave.

Dependencies:   mbed

Revision:
0:113570912de7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/motor_test.cpp	Mon Oct 06 14:56:56 2014 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+
+PwmOut speed = PTE21;       //speed
+DigitalOut direct = PTE20;  //direction
+
+int main() {
+    float t = 0;
+    float val;
+          
+    while(1){
+        val = sin(t)/4;     //motor speed follows a sine wave
+        t += 0.00314f;
+        
+        if(val < 0){        //when val is negative switch direction
+            direct = 1;
+            speed = val * -1f;
+        }
+        else{
+            direct = 0;
+            speed = val;
+        }
+        
+        wait_us(2500);
+    }
+}
\ No newline at end of file