Chris Styles
/
EA_RotaryEncoder
This example positions a lit LED in the I2C LED array using the rotary encoder
Diff: RotaryEncode.h
- Revision:
- 0:498b9b4a7bb9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RotaryEncode.h Tue Mar 02 08:27:23 2010 +0000 @@ -0,0 +1,38 @@ +/* Rotary Encoder + * (c) 2009, cstyles + */ + +#ifndef ROTARY_ENCODE_H +#define ROTARY_ENCODE_H + +#include "mbed.h" + +#define R_W 0 +#define R_L1 1 +#define R_L2 2 +#define R_L3 3 +#define R_R1 4 +#define R_R2 5 +#define R_R3 6 + + +class RotaryEncode { + +public: + + RotaryEncode(PinName A, PinName B); + int read (void); + +protected: + + BusIn _rotary_in; + Ticker _ticker; + void _ticker_handler (void); + + int _position; + int _state; + int _e; + +}; + +#endif