Version 1.0.4
This library is an attempt of obtaining the most properties from rotary encoders as possible. You can get the direction of the last rotation, set the number of steps per turn of your exact model of encoder and even convert the rotation into degrees or radians.
This library was tested on avr, megaavr, sam, samd, nrf52, mbed, mbed_nano, mbed_rp2040 architectures so you should be able to use it without problems.
To use this library, open the Library Manager in the Arduino IDE, type in "NewEncoder" and install it from there. More on that in the following link
- 1.0.4
This library allows an Arduino board to read various parameters from rotary encoders. This devices use two square signals that can be translated into how much the encoder rotates. With this library you can read the rotation of each encoder as well as make usage of the integrated switch button.
The NewEncoder library supports various simultaneous encoders without the need of interrupt pins.
To make use of this library you first need to include the library file and create an instance of an encoder:
#include <NewEncoder.h>
NewEncoder myEncoder;
Usually, rotary encoders have 5 pins in total: CLK (or A pin), DATA (or B pin), SW (Switch button), power and ground. The power wire should be connected to the 5V pin on the Arduino board. The ground is connected to any of the ground pins of the Arduino. The CLK, DATA and SW pins can be connected anywhere else in the board and we must declare which pin is connected to which encoder in the begin()
function.
Basic read: Demonstrates the functionality of the methods of the library
Simultaneous encoders: Shows how to handle multiple encoders at the same time
You can see the list of all functions along with some information about the use cases of each one in this functions explanation file
begin()
You can always contact me at alexandrocb2013@gmail.com for questions and I'll help you sort it out.
Find a bug or want to request a new feature? Please let me know by submitting an issue.
- Alex Casal - Initial work - alexitoo00 |
This project is licensed under the MIT License - see the LICENSE file for details