Page 1 of 1

CF2 - NeoPixelRing - Full HD Color Rainbow

Posted: Tue Dec 30, 2014 5:06 pm
by chonchonchon
Hi guys !

- FULLCOLOR RING Rotating circle with RAINBOW effect (like photo).
- UNICOLOR ring with Rainbow change effect (like PHILIPS LAMP)

Include a full RGB to HSV transformation function.
image1.JPG
image2.JPG
If someone is interrested about code source, please told me what i have to upload (FILE > cflie.bin? , neopixelring.c? , full project folder? or copy past of source code ?)

Thanks for your help

... I really love this new toy, it's awesome ! ...so funny !!!

Re: CF2 - NeoPixelRing - Full HD Color Rainbow

Posted: Fri Jan 02, 2015 10:42 am
by dbrgn
Nice effect. Could you post your effect function (the one with signature static void yourEffect(uint8_t buffer[][3], bool reset))?

Re: CF2 - NeoPixelRing - Full HD Color Rainbow

Posted: Sun Jan 04, 2015 8:20 pm
by chonchonchon
1. Declare 4 following variables at beggining of neopixelring.c

static int red;
static int green;
static int blue;
static uint8_t RGB_direction=1, RGB_step=1;

2. Don't forget to add the "RainbowRing" and "ColorLamp" in the effect list at the end of the file.

3. Copy the 3 following functions
- setLedColorHSV function
- RainbowRing function
- ColorLamp function

4. Select the effect using the Parameter tab in cfClient !

''! ENJOY !''

Chon
--------------------------------------------------------

static void setLedColorHSV(int h, double s, double v)
{
double r=0;
double g=0;
double b=0;

int i=(int)h/60.0;

double f = h/60.0 - i;
double pv = v * (1 - s);
double qv = v * (1 - s * f);
double tv = v * (1 - s * (1 - f));

switch (i)
{
case 0: // red dominant
r = v;
g = tv;
b = pv;
break;

case 1: // green
r = qv;
g = v;
b = pv;
break;

case 2: //
r = pv;
g = v;
b = tv;
break;

case 3: // azur
r = pv;
g = qv;
b = v;
break;

case 4: //
r = tv;
g = pv;
b = v;
break;


case 5: // red
r = v;
g = pv;
b = qv;
break;

}

red = LIMIT(255*r);
green = LIMIT(255*g);
blue = LIMIT(255*b);

}



static void RainbowRing(uint8_t buffer[][3], bool reset)
{
uint8_t temp[3];
int i;

if (reset)
{

for (i=0; i<NBR_LEDS ; i++) {

int final = 32 *i;
setLedColorHSV(final,1,1);
buffer[0] = red;
buffer[1] = green;
buffer[2] = blue;
}
}

COPY_COLOR(temp, buffer[(NBR_LEDS-1)]);
for (i=(NBR_LEDS-1); i>=0; i--) {
COPY_COLOR(buffer, buffer[i-1]);
}
COPY_COLOR(buffer[0], temp);


}



static void ColorLamp(uint8_t buffer[][3], bool reset)
{
int i;

if (RGB_direction == 1 ) {
RGB_step = RGB_step + 1;
if (RGB_step >= 255 ){ RGB_direction = 0;}
}

else

{
RGB_step = RGB_step - 1;
if (RGB_step <= 0 ){ RGB_direction = 1;}
}


for (i=0; i<NBR_LEDS ; i++) {


setLedColorHSV(RGB_step,1,1);
buffer[0] = red;
buffer[1] = green;
buffer[2] = blue;
}

}

Re: CF2 - NeoPixelRing - Full HD Color Rainbow

Posted: Mon Jan 05, 2015 2:49 pm
by marcus
Really nice effect! It would be great if you wanted to create a pull-request for the code. Otherwise I could merge it in manually if that would be ok, since it's definitely something we would love to have in the firmware.

Re: CF2 - NeoPixelRing - Full HD Color Rainbow

Posted: Thu Feb 19, 2015 9:17 pm
by Call_me_a_Cab
These effects are awesome!!!

I had to change the first 3 declares and the occorences of them in the effects to make it compile though....

I just added "2" after red green and blue