AR-168IntermediatePremium

A Menu That Never Skips: Rotary Encoder with Interrupts (Arduino + KY-040 + I2C LCD)

Both pins of the KY-040 rotary encoder are read with interrupts, and you build a turn-and-press settings menu on an I2C LCD: brightness, volume and timer. Even with a slow 50 ms job in the loop, not a single step is lost. In the Step test, spin the encoder fast: in the video the interrupt counted 50 steps, the loop only 10. Covers direction decoding with a state table and debouncing.

0.0(0)
A Menu That Never Skips: Rotary Encoder with Interrupts (Arduino + KY-040 + I2C LCD)
You build a screen you adjust with a turning knob, like the menus on an oven or an air conditioner. However fast you spin the knob, the board catches every click and the value stops exactly where you left it. On the test screen you count the same spin with a plain read as well and see with your own eyes that it misses most of the clicks.

Source Code

Premium Content

The source code, block version and FAQ of this project are open to Premium members.

  • All Project Code
  • Block version
  • Frequently Asked Questions