Motor

Fork of Motor by Reiko Randoja

motor.h

Committer:
Reiko
Date:
2013-08-31
Revision:
1:c97f8bcd6c0f
Parent:
0:5cafacc2a607
Child:
2:3faf5dcde08f

File content as of revision 1:c97f8bcd6c0f:

#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 pid();
    
    int setPoint;
    float pMulti;
    float iMulti;
    int error;
    int prevError;
    float P;
    float I;
};

#endif