Rotary Encoder Craziness

  Рет қаралды 3,912

Grateful Frog

Grateful Frog

Күн бұрын

Have you been fighting with bounce and rotary encoders in your Arduino project?
Well I have!
This little video shows how to use Keyed Rotary Encoders in Arduino Code.
This is a the encoder: www.aliexpress...
The idea is that when the key is pressed, the arduino will start counting encoder ticks, positive clockwise, or negative counter-clockwise. The display is updated on change in counts.
Since these encoders have built in hardware debouncing, no need to play around with delays and so on.
The code uses the C-preprocessor to generate method definitions for the 10 sets of interrupt handlers needed.
For a given encoder:
1. set an interrupt handler to fire on key pin falling edge:
- this handler sets an interrupt handler on falling edge for the encoder S1 pin, as well as a new handler for the rising edge of key pin.
2. the S1 falling edge handler looks at S2 and increments or decrements the tick count,
3. the risinge edge key pin handler unsets the handler on S1 and resets the falling edge handler fo the key pin.
The 5 encoder code as well as a simpler single encoder version is available in my repo: gitlab.com/gra...

Пікірлер: 7
@arduinomaquinas
@arduinomaquinas 8 ай бұрын
Very cool video, useful 👏👏👏 informations, subscribed 😉👍
@danielroibert5631
@danielroibert5631 2 жыл бұрын
Cher Monsieur Grateful Frog, J’aurais aimé savoir pourquoi vous utilisez deux interrupts par encodeur ? Est-ce un interrupt pour le rotary et un interrupt pour le push button ? Meilleurs vœux.
@GratefulFrog
@GratefulFrog 2 жыл бұрын
Oui, un pour le pushbutton l'autre pour l'encodeur. Le code est généré par le pré-processeur du compilateur C...
@danielroibert5631
@danielroibert5631 2 жыл бұрын
@@GratefulFrog Ah, super merci. :-) C’est parce que ça fait beaucoup d’interrupt et que dans certaines situations, on pourrait alors peut-être, se passer de l’interrupt du push button ? Bonne journée.
@danielroibert5631
@danielroibert5631 3 жыл бұрын
Bonjour, intéressent. Merci. Mais d’après les photos, il n’y a que de la filtration passive, donc ça devrait marcher aussi bien en 3,3V ou autre ?
@GratefulFrog
@GratefulFrog 3 жыл бұрын
Oui, (oh Maître;-) ça marche en 3.3v, c'est comme ça que j'utilise ces encodeurs car l'arduino MKR série est en 3.3v ;-)
@arduinomaquinas
@arduinomaquinas 8 ай бұрын
@arduinomaquinas thank you bro !
Rotary Encoder (KY-040) Debounce Circuit Tutorial
15:03
ForceTronics
Рет қаралды 18 М.
Rotary Encoders: A Comprehensive Guide to Understanding and Using Them
7:44
БЕЛКА СЬЕЛА КОТЕНКА?#cat
00:13
Лайки Like
Рет қаралды 2,8 МЛН
Life hack 😂 Watermelon magic box! #shorts by Leisi Crazy
00:17
Leisi Crazy
Рет қаралды 21 МЛН
Spongebob ate Patrick 😱 #meme #spongebob #gmod
00:15
Mr. LoLo
Рет қаралды 19 МЛН
High precision speed reducer using rope
20:19
Aaed Musa
Рет қаралды 1,8 МЛН
Have you ever seen soldering THIS close?
9:53
Robert Feranec
Рет қаралды 466 М.
Not enough Arduino Pins? Try this I2C Port Expander! | Chip Tips #1: PCF8574
7:59
I built my own graphics card
15:34
jdh
Рет қаралды 1,5 МЛН
Arduino with I2C LCD and Rotary Encoder
16:21
John Miller
Рет қаралды 29 М.
Magnetic rotary encoder vs stepper motor accuracy
5:41
Matthias random stuff
Рет қаралды 148 М.
#226 ROTARY ENCODER with no switch bounce 🤓 - you MUST use this
25:49
How to use rotary encoders
14:12
FriendlyWire
Рет қаралды 36 М.
БЕЛКА СЬЕЛА КОТЕНКА?#cat
00:13
Лайки Like
Рет қаралды 2,8 МЛН