Carlo Collodi / kangaroo

Dependencies:   QEI mbed

Revision:
35:a4e89e78d034
Parent:
28:21773a6fb6df
Child:
37:bf257a0154db
diff -r 21773a6fb6df -r a4e89e78d034 src/motor.cpp
--- a/src/motor.cpp	Sun Nov 24 19:04:01 2013 +0000
+++ b/src/motor.cpp	Sun Nov 24 20:18:17 2013 +0000
@@ -1,9 +1,8 @@
 #include "mbed.h"
 #include "include/motor.hpp"
 
-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
-    encoder = enc
+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
+    
     freq =.001;
     voltage = 12.0;
     mode=0;
@@ -21,8 +20,6 @@
 void Motor::stop(){
     t.detach();
     pwmOut.write(0);
-    dAngle=0;
-    dAngularVelocity=0;
 }
 
 void Motor::zero(){
@@ -70,7 +67,7 @@
     return (1/.140)*3.3 * aIn;
 }
 
-int Motor::getPos()
+float Motor::getMotorPos()
 {
     return encoder.getPulses();
 }