This example positions a lit LED in the I2C LED array using the rotary encoder

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RotaryEncode.h Source File

RotaryEncode.h

00001 /* Rotary Encoder 
00002  * (c) 2009, cstyles
00003  */
00004  
00005 #ifndef ROTARY_ENCODE_H
00006 #define ROTARY_ENCODE_H
00007 
00008 #include "mbed.h"
00009 
00010 #define R_W  0
00011 #define R_L1 1
00012 #define R_L2 2
00013 #define R_L3 3
00014 #define R_R1 4
00015 #define R_R2 5
00016 #define R_R3 6
00017 
00018 
00019 class RotaryEncode {
00020 
00021 public:
00022 
00023     RotaryEncode(PinName A, PinName B);          
00024     int read (void);
00025                   
00026 protected:
00027 
00028     BusIn _rotary_in;    
00029     Ticker _ticker;
00030     void _ticker_handler (void);
00031     
00032     int _position;
00033     int _state;
00034     int _e;
00035     
00036 };
00037 
00038 #endif