https://github.com/nopnop2002/esp-idf-rotaryencoder
RotaryEncoder driver for esp-idf
https://github.com/nopnop2002/esp-idf-rotaryencoder
esp-idf esp32 rotary-encoder
Last synced: 8 months ago
JSON representation
RotaryEncoder driver for esp-idf
- Host: GitHub
- URL: https://github.com/nopnop2002/esp-idf-rotaryencoder
- Owner: nopnop2002
- License: mit
- Created: 2023-03-09T07:54:59.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-05-29T01:49:08.000Z (about 1 year ago)
- Last Synced: 2025-06-11T21:54:25.822Z (about 1 year ago)
- Topics: esp-idf, esp32, rotary-encoder
- Language: C
- Homepage:
- Size: 9.77 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# esp-idf-RotaryEncoder
RotaryEncoder driver for esp-idf.
I ported from [this](https://haizairenmei.com/2019/12/05/rotary-encoder/).
Calculating the direction of movement is very simple.
This is the Japanese homepage.
# Software requirements
ESP-IDF V5.0 or later.
ESP-IDF V4.4 release branch reached EOL in July 2024.
ESP-IDF V5.1 is required when using ESP32C6.
# Installation
```
git clone https://github.com/nopnop2002/esp-idf-RotaryEncoder
cd esp-idf-RotaryEncoder
idf.py set-target {esp32/esp32s2/esp32s3/esp32c2/esp32c3/esp32c6}
idf.py menuconfig
idf.py flash
```
# Configure for RotaryEncoder


# Configure for Appication
There are 2 APIs.
One is an API that uses CallBack and the other is an API that does not use CallBack.



# Wireing
|RotaryEncoder||ESP32|ESP32-S2/S3|ESP32-C2/C3/C6|
|:-:|:-:|:-:|:-:|:-:|
|OUT A|--|GPIO15|GPIO15|GPIO1|
|OUT B|--|GPIO16|GPIO16|GPIO2|
|SWITCH|--|GPIO17|GPIO17|GPIO3|
|GND|--|GND|GND|GND|
|VCC|--|3.3V|3.3V|3.3V|
You can change any GPIO using menuconfig.

The RotaryEncoder has two forms, but the functionality is the same.

# How to use this component in your project
Create idf_component.yml in the same directory as main.c.
```
YourProject --+-- CMakeLists.txt
+-- main --+-- main.c
+-- CMakeLists.txt
+-- idf_component.yml
```
Contents of idf_component.yml.
```
dependencies:
nopnop2002/RotaryEncoder:
path: components/RotaryEncoder
git: https://github.com/nopnop2002/esp-idf-RotaryEncoder.git
```
When you build a projects esp-idf will automaticly fetch repository to managed_components dir and link with your code.
```
YourProject --+-- CMakeLists.txt
+-- main --+-- main.c
| +-- CMakeLists.txt
| +-- idf_component.yml
+-- managed_components ----- nopnop2002__RotaryEncoder
```
# ScreenShot
The value of Count changes by 4 per click.
