It was my first time working with a rotary encoder, so I started by looking at the Lab: Using a Rotary Encoder to understand how it works.
The lab used this library in their manual.
Following the lab, I was able to print a new number with each tick of the rotary encoder.
I added interrupt pins to get smoother readings than just using the digitalRead().
Since I am going to use the rotary encoder in conjunction with the neopixel ring, I set the rotary encoder to reset after reaching a full cycle of the neopixel ring. The neopixel ring has 24 LEDs, so I had the rotary counter to reset to zero on the 25th number.
Originally, I wanted to utilize the entire 360 values of hue in p5’s HSB color mode. However, it wouldn’t be practical to have people scroll to a value in the 300s. Thus, I plan to map hue to the 24 rotary encoder ticks.
Using the inherent pushbutton inside the rotary encoder, I wanted the possibility of denoting the hue value recorded, along side the saturation and brightness values.
final code: