Rotary Encoder

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.

IMG_8109.HEIC

Screen Shot 2022-11-29 at 3.20.49 PM.png

The lab used this library in their manual.

IMG_8110.HEIC

Screen Shot 2022-11-29 at 2.24.08 PM.png

Screen Shot 2022-11-29 at 2.24.29 PM.png

Screen Shot 2022-11-29 at 2.24.41 PM.png

Screen Shot 2022-11-29 at 2.23.53 PM.png

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().

Screen Shot 2022-11-29 at 2.25.57 PM.png

Screen Shot 2022-11-29 at 2.26.01 PM.png

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.

Screen Shot 2022-11-29 at 2.31.34 PM.png

Screen Shot 2022-11-29 at 2.31.45 PM.png

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.

Screen Shot 2022-11-29 at 2.44.46 PM.png

Screen Shot 2022-11-29 at 2.44.52 PM.png

Screen Shot 2022-11-29 at 2.44.33 PM.png

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:

Screen Shot 2022-11-29 at 2.45.04 PM.png

Screen Shot 2022-11-29 at 2.45.12 PM.png

Screen Shot 2022-11-29 at 2.45.17 PM.png