Fork of Emaxx Navigation code with dynamic vehicle model and HIL support. Strange bugs with mbed locking up upon receiving certain messages.

Dependencies:   BNO055_fusion Vehicle_Model MODSERIAL ServoIn ServoOut mbed

Fork of Emaxx_Navigation by Emaxx Navigation Group

motor_driver.h

Committer:
jdawkins
Date:
2017-04-07
Revision:
8:9817993e5df7

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