FastLED setRGB Function for Changing LED Colors
I found and tweaked the following code from Scott Kletzien in the FastLED Google+ Community. The setRGB function threw me off at first, since I thought it worked like the HSV settings.
Here's the simplified guide to setRGB
The full function will look like the following in your sketch or code.
leds[i].setRGB(0,255,0);
Another way to look at it is leds[i].setRGB(RED AMOUNT, GREEN AMOUNT, BLUE AMOUNT);
The amounts can range from 0 to 255. So if you set the red to 255 and the other values to 0, you'll get red LEDs showing.
leds[i].setRGB(255,0,0); will turn the LEDs to red
leds[i].setRGB(0,255,0); will turn the LEDs to green
leds[i].setRGB(0,0,255); will turn the LEDs to blue
Using all the values at once will give you a huge range of colors.
leds[i].setRGB(241,124,200); will turn the LEDs to a pink color.
HINT: If you're trying to find the code for a specific color, a lot of graphics programs let you pick a color and give you the RGB settings. (I use GIMP, which is like a free version of Photoshop).
No comments:
Post a Comment