stewartplatform

Dependencies:   mbed

Fork of PwmOut_HelloWorld by Mbed

src/motor.cpp

Committer:
wheels
Date:
2016-05-07
Revision:
2:50062ac8646d
Child:
3:c5ea5b6a7460

File content as of revision 2:50062ac8646d:

#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;
}