SeeLog / RotaryEncoder

RotaryEncoder library for Arduino Uno etc...

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RotaryEncoder library

RotaryEncoder library for Arduino Uno etc...

I checked the operation with EC12PLRGBSDVBF-D-25K-24-24C-61

Example program is here

日本語の説明はこちら

Tutorial

image

1. Copy library files to your project

  • RotaryEncoder.h
  • RotaryEncoder.cpp

2. Include library

#include "RotaryEncoder.h"

3. Set up

  1. define interruptable pin numbers
#define PIN_A 2
#define PIN_B 3
  1. define and initialize RotaryEncoder object
RotaryEncoder encoder = RotaryEncoder(PIN_A, PIN_B);

4. Get encoded value

int val = encoder.getRotationValue();

Other

  • 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,...

About

RotaryEncoder library for Arduino Uno etc...


Languages

Language:C++ 100.0%