![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
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
Diff: motor_driver.h
- Revision:
- 8:9817993e5df7
- Child:
- 9:3aa9b689bda5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/motor_driver.h Fri Apr 07 17:12:29 2017 +0000 @@ -0,0 +1,29 @@ + +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; + } + +} \ No newline at end of file