How can I make a rotary encoder change between neopixel programs?

2017-11-19 04:40:17

I am making a program to use a rotary encoder instead of a button in the buttoncycler example in the Adafruit NeoPixel library.

I reduced the number of programs to 8, and used this code to get the "button position"from my 256 cpr encoder:int position = abs(encoderPostition/64)%8;

I was wondering if there is a way to change the program immediately after turning the rotary encoder.

I am using the US Digital S1-256-250-IE-B-D. Datasheet can be found here:

P.S. I know it is a very expensive encoder, but my project lead told me to use it.