Rotary Encoder Craziness

preview_player
Показать описание
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.

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.

Рекомендации по теме
Комментарии
Автор

Very cool video, useful 👏👏👏 informations, subscribed 😉👍

arduinomaquinas
Автор

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 ?

danielroibert
Автор

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.

danielroibert
welcome to shbcf.ru