Mouse code for the MacroRat
Diff: motor.h
- Revision:
- 7:6f5cb6377bd4
- Parent:
- 4:b5b7836ca2b0
- Child:
- 8:a0760acdc59e
diff -r 3d68fedd6fd9 -r 6f5cb6377bd4 motor.h --- a/motor.h Thu May 04 21:38:20 2017 +0000 +++ b/motor.h Fri May 05 00:08:59 2017 +0000 @@ -4,6 +4,8 @@ #include "mbed.h" #include "main.h" +#include "QEI.h" + #define BRAKE_VOLTAGE 0.2 extern PwmOut left1; @@ -11,12 +13,22 @@ extern PwmOut right1; extern PwmOut right2; -inline void rightWheelForward(double voltage) { +extern DigitalOut enableLeftMotor; +extern DigitalOut enableRightMotor; + +//QEI leftWheel( + +inline void enableMotors(){ + enableLeftMotor.write(1); + enableRightMotor.write(1); +} + +inline void rightWheelBackward(double voltage) { right1.write(voltage); right2.write(0); } -inline void rightWheelBackward(double voltage) { +inline void rightWheelForward(double voltage) { right1.write(0); right2.write(voltage); }