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:
2018-04-03
Revision:
9:3aa9b689bda5
Parent:
8:9817993e5df7

File content as of revision 9:3aa9b689bda5:


DigitalOut mot_ph1(p23, 0);       
DigitalOut mot_ph2(p24, 0);
PwmOut mot_en(p25);

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