Change color of the RGB ring with rotary encoder

Hi everybody,

I need to gradually change colors of my RGB Ring with my rotary encoder. I found this video that exactly shows the effect I need:

Any ideas?

Thx
Luca

(deleted)

I found a possible solution, as shown in the code I quote next. But I would like to improve it in something smarter and more dinamic than that one as in the video I quoted in the previous post.

[cut]

if (encoderValue <= 250) {
    colore = 1;
  }

  if (encoderValue >= 251 & encoderValue <= 350) {
    colore = 2;
  }

  if (encoderValue >= 351 & encoderValue <= 450) {
    colore = 3;
  }  

[cut]

void startShow(int i) {
  switch (i) {
    case 0: colorWipe(ring.Color(0, 0, 255), 0);        // blu  colorWipe(ring.Color(COLORE, COLORE, COLORE), quanto tempo passa dall'accensione din un led all'altro);
      break;
    case 150: colorWipe(ring.Color(0, 255, 0), 0);        // verde
      break;
    case 250: colorWipe(ring.Color(255, 255, 0), 0);      // giallo
      break;
    case 350: colorWipe(ring.Color(255, 0, 0), 0);        // rosso
      break;
  }
}

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for (uint16_t i = 0; i < ring.numPixels(); i++) {
    ring.setPixelColor(i, c);
    ring.show();
    delay(wait);
  }
}

This is not a good code because if I want to switch from one color to another by the gradient (as in the video), I should do lots of IF ....

Define "more dynsmic" and "smarter" :wink:

And plesse post complete code.

I found it!....this is a solution!

thx