Colour fading Neopixels with rotary encoder

  • SOLVED -

Hi everyone

I am trying make my Neopixel digital RGB strip (with 60 LEDs) change from blue to red (and vice versa) depending on my rotary encoder. I've made it work so that it changes colour, but I would like to make it fade nicely by slowly changing the hue.

I have made a function which should make the colour fade. But the LEDs still only change directly from the first colour to the second. I'm not sure why. If you have any idea, I've included the code below. Please let me know if you have suggestions. And thank you!

  for (int i = 65536 - (65536 * 2 / 3); i > 0; i -= 255)

Which Arduino board are you using ?

Sorry I didn't include that! That's of course important. I am using the Arduino Uno.

I am using the Arduino Uno.

 for (int hueA = (65536*2/3); hueA < 65536; hueA += 255)

What is the largest number that can be held in a signed int on a Uno ?

Please look at Read this before posting a programming question then edit your post to add code tags. It would also be a good idea to delete the code and copy it again from the IDE having used Auto Format to tidy it up a bit too.