Motor
Fork of Motor by
Diff: motor.h
- Revision:
- 1:c97f8bcd6c0f
- Parent:
- 0:5cafacc2a607
- Child:
- 2:3faf5dcde08f
diff -r 5cafacc2a607 -r c97f8bcd6c0f motor.h --- a/motor.h Mon Jul 29 20:25:33 2013 +0000 +++ b/motor.h Sat Aug 31 15:58:46 2013 +0000 @@ -2,24 +2,37 @@ #define MOTOR_H #include "mbed.h" +#include "PCA9555.h" +#include "qed.h" class Motor { public: - Motor(PinName PWMpin, PinName dir1Pin, PinName dir2Pin); + Motor(PinName PWMpin, PCA9555 *ioExt, unsigned int dir1Pin, unsigned int dir2Pin, PinName encA, PinName encB); + void setPWM(float newPWM); void setSpeed(int newSpeed); int getSpeed(); + void pid(); private: - void pid(); - - InterruptIn interruptA; - InterruptIn interruptB; + PwmOut pwm; + PCA9555 *extIO; + unsigned int dir1; + unsigned int dir2; + QED qed; + + int currentSpeed; + int getDecoderCount(); - volatile int pulses; + //void pid(); - int prevState; - int currState; + int setPoint; + float pMulti; + float iMulti; + int error; + int prevError; + float P; + float I; }; #endif \ No newline at end of file