|
upm
0.2.0
Sensor/Actuator repository for libmraa (v0.6.1)
|
C++ API for the Grove Rotary Encoder. More...
UPM module for the Grove Rotary Encoder. A Rotary Encoder encodes a rotation signal into electronic pulses that can be used to measure rotation and direction. It is useful in cases where a rotary knob is required, but using a potentiometer is not desirable. A rotary encoder can turn a full 360 degrees+ without a stop and does not place a resistive load on the circuit, as is the case with a potentiometer.
This module maintains a position that is incremented or decremented according to the rotation on the encoder.
Public Member Functions | |
| RotaryEncoder (int pinA, int pinB) | |
| ~RotaryEncoder () | |
| void | initPosition (int count=0) |
| int | position () |
Static Public Member Functions | |
| static void | signalAISR (void *ctx) |
| RotaryEncoder | ( | int | pinA, |
| int | pinB | ||
| ) |
RotaryEncoder constructor
| pinA | digital pin to use for signal A |
| pinB | digital pin to use for signal B |
| ~RotaryEncoder | ( | ) |
RotaryEncoder Destructor
| void initPosition | ( | int | count = 0 | ) |
Reset the position to a given number, default is 0.
| count | integer to initialize the position to |
| int position | ( | ) |
Get the position value
|
static |
ISR for signal A
| ctx | user context for the ISR (*this pointer) |
1.8.9.1