RotaryEncoder library for Arduino Uno etc...
I checked the operation with EC12PLRGBSDVBF-D-25K-24-24C-61
Example program is here
日本語の説明はこちら
- RotaryEncoder.h
- RotaryEncoder.cpp
#include "RotaryEncoder.h"- define interruptable pin numbers
#define PIN_A 2
#define PIN_B 3- define and initialize RotaryEncoder object
RotaryEncoder encoder = RotaryEncoder(PIN_A, PIN_B);int val = encoder.getRotationValue();- Set max value and min value
encoder.setMaxValue(255);
encoder.setMinValue(0);- Set increase and decrease value
encoder.skipValue = 4;If set this, the value will increase to 0, 4, 8, ... and decrease to 0, -4, -8, ...
- Value rotation
encoder.isRotateValue = true;If the max value is 10 and the min value is 0, the value will increase to ...,9,10,0,1,... and decrease to ...,1,0,10,9,...
