Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: src/motor.cpp
- Revision:
- 37:bf257a0154db
- Parent:
- 35:a4e89e78d034
- Child:
- 38:922f2584bdfd
- Child:
- 43:68faf056ed5c
diff -r a4e89e78d034 -r bf257a0154db src/motor.cpp
--- a/src/motor.cpp Sun Nov 24 20:18:17 2013 +0000
+++ b/src/motor.cpp Sun Nov 24 20:38:59 2013 +0000
@@ -1,8 +1,8 @@
#include "mbed.h"
#include "include/motor.hpp"
-Motor::Motor(PinName aPin, PinName fPin, PinName bPin, PinName pwmPin, PinName encA, PinName encB):aIn(aPin),Forward(fPin),Backward(bPin),pwmOut(pwmPin),encoder(encA, encB, NC, 1200, QEI::X4_ENCODING){ //15,17,18,21,25,26 and 16,19,20,22,23,24
-
+Motor::Motor(PinName aPin, PinName fPin, PinName bPin, PinName pwmPin, QEI &enc):aIn(aPin),Forward(fPin),Backward(bPin),pwmOut(pwmPin),encoder(enc){
+//15,17,18,21,qei25,26 and 16,19,20,22,qei23,24
freq =.001;
voltage = 12.0;
mode=0;
@@ -20,6 +20,8 @@
void Motor::stop(){
t.detach();
pwmOut.write(0);
+ dAngle=0;
+ dAngularVelocity=0;
}
void Motor::zero(){
@@ -67,7 +69,7 @@
return (1/.140)*3.3 * aIn;
}
-float Motor::getMotorPos()
+int Motor::getPos()
{
return encoder.getPulses();
}
