stewartplatform

Dependencies:   mbed

Fork of PwmOut_HelloWorld by Mbed

Revision:
2:50062ac8646d
Child:
3:c5ea5b6a7460
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/motor.cpp	Sat May 07 12:27:09 2016 +0000
@@ -0,0 +1,21 @@
+#include "motor.h"
+
+PwmOut motor[6] = {PwmOut(D8), PwmOut(D9), PwmOut(D10), PwmOut(D11), PwmOut(D12), PwmOut(D13)};
+extern char position[6];
+
+void motor_drive() {
+    for(int index = 0; index < 6; index++) {
+        float duty = (0.000417 * position[index] + 0.05);
+        motor[index] = duty;            
+    }
+}
+
+void motor_init() {
+        for (int index = 0; index < 6; index++) {
+                motor[index].period(0.020);                                 //cycle period is 20ms
+                motor[index] = 0.075;                                               //control pulse width is 1ms~2ms? should be confirmed!!
+        }
+//      motor[0].period(0.020);
+//      motor[0] = 0.05;
+}
+ 
\ No newline at end of file