stewartplatform

Dependencies:   mbed

Fork of PwmOut_HelloWorld by Mbed

Committer:
wheels
Date:
Sat May 07 12:27:09 2016 +0000
Revision:
2:50062ac8646d
Child:
3:c5ea5b6a7460
stewart platform

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wheels 2:50062ac8646d 1 #include "motor.h"
wheels 2:50062ac8646d 2
wheels 2:50062ac8646d 3 PwmOut motor[6] = {PwmOut(D8), PwmOut(D9), PwmOut(D10), PwmOut(D11), PwmOut(D12), PwmOut(D13)};
wheels 2:50062ac8646d 4 extern char position[6];
wheels 2:50062ac8646d 5
wheels 2:50062ac8646d 6 void motor_drive() {
wheels 2:50062ac8646d 7 for(int index = 0; index < 6; index++) {
wheels 2:50062ac8646d 8 float duty = (0.000417 * position[index] + 0.05);
wheels 2:50062ac8646d 9 motor[index] = duty;
wheels 2:50062ac8646d 10 }
wheels 2:50062ac8646d 11 }
wheels 2:50062ac8646d 12
wheels 2:50062ac8646d 13 void motor_init() {
wheels 2:50062ac8646d 14 for (int index = 0; index < 6; index++) {
wheels 2:50062ac8646d 15 motor[index].period(0.020); //cycle period is 20ms
wheels 2:50062ac8646d 16 motor[index] = 0.075; //control pulse width is 1ms~2ms? should be confirmed!!
wheels 2:50062ac8646d 17 }
wheels 2:50062ac8646d 18 // motor[0].period(0.020);
wheels 2:50062ac8646d 19 // motor[0] = 0.05;
wheels 2:50062ac8646d 20 }
wheels 2:50062ac8646d 21