Fork van Victor Sluiters library. Output van speed is nu een double i.p.v. float.
Fork of Encoder by
Diff: encoder.h
- Revision:
- 0:c90b36abcbf8
- Child:
- 1:2dd7853c911a
diff -r 000000000000 -r c90b36abcbf8 encoder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/encoder.h Wed Sep 25 14:55:08 2013 +0000 @@ -0,0 +1,27 @@ +#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_ \ No newline at end of file