Control Surface
main
MIDI Control Surface library for Arduino
|
This example reads multiple encoders using pin change interrupts, on an Arduino Uno or Nano.
The ATmega328P microcontroller only has two interrupt pins (2 and 3), so if you want to use more than two interrupt-driven encoders, you'll either have to use a timer interrupt to continuously poll the encoders, or use the chip's pin change interrupts. This example demonstrates the latter.
Familiarity with direct port manipulation is assumed.
Connect three encoders to the pins of port C as follows:
Connect the common pins to ground, the internal pull-up resistors will be enabled.
When the position of one of the encoders changes, it is printed to the Serial monitor.
Written by PieterP, 2021-08-11
https://github.com/tttapa/Arduino-Helpers