Motor
Fork of Motor by
motor.h
- Committer:
- Reiko
- Date:
- 2013-09-14
- Revision:
- 2:3faf5dcde08f
- Parent:
- 1:c97f8bcd6c0f
- Child:
- 3:94db629c0a83
File content as of revision 2:3faf5dcde08f:
#ifndef MOTOR_H #define MOTOR_H #include "mbed.h" #include "PCA9555.h" #include "qed.h" class Motor { public: 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: PwmOut pwm; PCA9555 *extIO; unsigned int dir1; unsigned int dir2; QED qed; int currentSpeed; int getDecoderCount(); void resetPID(); //void pid(); int setPoint; float pMulti; float iMulti; float dMulti; float error; float prevError; float P; float I; float D; float minPwm; }; #endif