Hi all,
I am using the following line of code
fill_solid( leds, NUM_LEDS, CRGB(50,0,200));
Does anybody know if it is possible to do the fill solid between certain leds e.g. fill solid from led 20 to 50 rather than NUM_LEDS?
Thanks for any help.
Hi all,
I am using the following line of code
fill_solid( leds, NUM_LEDS, CRGB(50,0,200));
Does anybody know if it is possible to do the fill solid between certain leds e.g. fill solid from led 20 to 50 rather than NUM_LEDS?
Thanks for any help.
you 'll have to write your own code for that.
obvious but write a loop
void fill_solid2( struct CRGB * leds,int start, int numToFill,
const struct CRGB& color)
for( int i = start; i < numToFill+start; i++) {
leds[i] = color;
}
}
//based on the fill_solid code of the fastLED library
or you can try that to play with pointers
void* fill_solid2(void* s,int start, int sz, uint32_t c) {
char* p = (char*)s;
p=p+start*3;
while (sz--)
{
memcpy(p,&c,3);
p=p+3;
}
return s;
}
//unless you go for 200000 leds it should not make any difference in term of speed.
use it like this
fill_solid2(leds,‘first led’,numbers of leds,color)
ie for your example
from 20 to 50 you have 50-20+1 =31 leds
fill_solid2(leds,12,31,CRBG(50.0.200));
hence
fill_solid( leds, NUM_LEDS, CRGB(50,0,200));
is equivalent to
fill_solid2( leds, 0,NUM_LEDS, CRGB(50,0,200));
Or use CRGBArray https://plus.google.com/102282558639672545743/posts/a3VeZVhRnqG
I think:
fill_solid(leds+20,30, CRGB(50,0,200));
Borrowed from Andrew Tulane’s example here:
Hi @paul_pritchard - as @Jeremy_Spencer stated: “use CRGBArray”. Here is a sketch of mine that uses fill_solid with CRGBArrays:
Thanks guys. I have got my code working using the CRGBArray.