UNFINISHED
Dependencies: HCSR04 SRF05 mbed
Diff: motor.cpp
- Revision:
- 1:60c79e942c98
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/motor.cpp Fri Jun 08 22:22:10 2018 +0000 @@ -0,0 +1,17 @@ +#include "mbed.h" +#include "motor.h" + +void Motor::setSpeed(float speed) +{ + if(speed > 0) { + motorA = direction?1:0; + motorB = direction?0:1; + } else { + motorA = direction?0:1; + motorB = direction?1:0; + } + + motorSpeed = speed; + + motorS = abs(speed); +}