Emaxx Navigation code ported for MBED

Dependencies:   BNO055_fusion Emaxx_Navigation_Dynamic_HIL MODSERIAL ServoIn ServoOut Vehicle_Model mbed

Fork of Emaxx_Navigation_Dynamic_HIL by Emaxx Navigation Group

motor_driver.h

Committer:
jdawkins
Date:
2017-04-07
Revision:
8:9817993e5df7
Child:
9:3aa9b689bda5

File content as of revision 8:9817993e5df7:


DigitalOut mot_ph1(p29, 0);       
DigitalOut mot_ph2(p30, 0);
PwmOut mot_en(p26);

void mot_control(float dc){        
    if(dc>1.0)
        dc=1.0;
        
    if(dc<-1.0)
        dc=-1.0;
    
        if(dc > 0.0){
            mot_ph2 = 0;
            mot_ph1 = 1;
            mot_en = dc;
        }
        else if(dc < -0.0){
            mot_ph1 = 0;
            mot_ph2 = 1;
            mot_en = abs(dc);
        }
        else{
            mot_ph1 = 0;
            mot_ph2 = 0;
            mot_en = 0.0;
        }
                       
}