Motor is operated by keyboard commands, encoder reads out position but not yet speed

Dependencies:   HIDScope

Dependents:   Project_motor Project_motor Motor_poscontrol Conceptcontroller_v_1_0

Fork of Encoder by Biorobotics Project

encoder.h

Committer:
vsluiter
Date:
2013-09-25
Revision:
0:c90b36abcbf8
Child:
1:2dd7853c911a

File content as of revision 0:c90b36abcbf8:

#ifndef _ENCODER_H_
#define _ENCODER_H_

#include "mbed.h"

class Encoder
{
    public:
    Encoder(PinName int_a, PinName int_b);
    int32_t getPosition(){return m_position;}
    void    setPosition(int32_t pos){m_position = pos;}
    float   getSpeed(){return m_speed;}
    private:
    void encoderFalling(void);
    void encoderRising(void);
    Timer EncoderTimer;
    Timeout EncoderTimeout;
    InterruptIn pin_a;
    DigitalIn pin_b;
    int32_t m_position;
    float   m_speed;
    void timeouthandler(void);
    bool zero_speed;
};


#endif //_ENCODER_H_