If you want something light a global brightness knob, you can call FastLED.setBrightness(x), where x is a value between 0 and 255.
If you want finer grained control over the brightness and color of each pixel check out this page:
If you want something light a global brightness knob, you can call FastLED.setBrightness(x), where x is a value between 0 and 255.
If you want finer grained control over the brightness and color of each pixel check out this page:
Dan, you added brightness support to the tiny too? I thought I read somewhere that you couldn’t do that because of the hardware limitation.
Ah - you’re right - I had already forgotten that this thread was for the tiny (too many threads both here and elsewhere today). Sorry Josh, there isn’t global brightness control for the tiny’s. Yet.
That said - last week I worked out a way to make it work, so now I just need a solid couple of days locked away from the world to work on it. I’ll even have room to spare!
oh i can not set brightness or fade? i read the title of this video and thought i could. https://www.youtube.com/watch?v=j-MrNN9i4dY#t=12
I see that he is also using another chip other than the attiny85 in the video though. Another question how would i code to turn on an individual pixel?
The only thing you can’t use on at ATtiny is the FastLED.setBrightness(…) function to adjust the whole strip’s brightness. You can program any pixel for any color or brightness you want individually.
Just set the pixels you want in the led array to the color and brightness you want, and call FastLED.show() to display them. Then delay a little bit, and repeat.
There’s a whole page on setting LED color here
https://code.google.com/p/fastspi/wiki/SetLEDColor
and a more comprehensive page on the RGB pixel data type (“CRGB”) here
https://code.google.com/p/fastspi/wiki/CRGBreference
Here’s some example code showing how to set the color of one pixel at a time. From this basic technique, you can make any animation you want – but it is going to take some work. I strongly recommend you just fool around with different pixel patterns and colors and so on for a day or so to get the hang of it. It does take time to learn it, but it pays off!
// Choose a random pixel, and make it light up a random color.
// Note that this code does not turn off the pixels afterward,
// so the strip will fill up with ever-changing colors.
void loop() {
// choose a random pixel number from 0…(NUM_LEDS-1)
int whichPixel = random( NUM_LEDS);
// choose a random hue (color)
int hue = random( 256 ); // random 0…255 for hue
int saturation = 255; // richest color
int brightness = 255; // brightest light level
// Set the chosen pixel in the led array to
// the randomly selected HSV color
leds[ whichPixel ] = CHSV( hue, saturation, brightness);
FastLED.show();
delay( 10 ); // 10 milliseconds = 1/100th of a second
// Note that the code does NOT ‘clear out’ the chosen
// pixel back to black after each loop, so the strip will
// fill up with ever changing colored pixels.
}
And just because it’s a crowd-pleaser, and fun to have something up and running, here’s a rainbow color wash using the built-in convenience function ‘fill_rainbow’, which sets a lot of pixels all at once to a rainbow of hues.
void loop() {
static byte starthue = 0; // start at red the first time
static byte huestep = 15; // how tight to make the rainbows
int interframeDelay = 10; // milliseconds
fill_rainbow( leds, NUM_LEDS, starthue, huestep);
FastLED.show();
delay(interframeDelay);
// advance to the next starting color for a scrolling effect
starthue++;
}
Just to illustrate the ‘any brightness you want for any pixel you want’ thing, here’s the same random pixel color loop again, but with random brightnesses, too:
void loop() {
int whichPixel = random( NUM_LEDS);
int hue = random( 256 ); // random 0…255 for hue
int saturation = 255; // richest color
int brightness = random(256); // RANDOM BRIGHTNESS 0…255
leds[ whichPixel ] = CHSV( hue, saturation, brightness);
FastLED.show();
delay( 10 );
}
So, as noted: anything is possible. The only thing that’s not currently available on the ATtiny is the master brightness control FastLED.setBrightness(…) Everything else is totally under your control and up to you!
Yeah I got it. This all would have been easier if I had started with a 328 chip lol
If you are using the Arduino IDE you would quickly realize the frustration with a 328; the IDE doesn’t work with that. You need to use a 328p. It makes a difference. All of the Arduino boards that use that chip are specifically the 328p variant. This is important if or when you start building your own clones.
i meant the 328p
Ok this is finally starting to make a little sense. How would i do a chase and fade? so led 1 comes on full then moves to led 2 then led 1 would be 80% and so on.
Read @Larry1 's post from five days ago about having an ‘RGB burst’ travel the string. In the comments there are various solutions to what you want to do.