I am working with FastLED on a Particle Photon in C++ and am trying to assign a new value to one of the elements of the pixel array.
Essentially, I have a array declared as such:
NSFastLED::CRGB leds[1];
I pass this into an "animation" class I've written in order to change the LED values:
void SomeClass::loop()
{
// Get the pointer to the current animation from a vector
Animation *currentAnim = animations.at(currentAnimation);
currentAnim->animate(leds);
...
}
In the animation, I am trying to do something really simple-- set an element of that LED array to some value. For testing, even setting it to a static integer "0" would be fine.
void MyAnimation::animate(NSFastLED::CRGB *leds)
{
for(int i = 0; i < numLeds; i++)
{
Serial.print(leds[i]); // "1"
leds[i] = 0;
Serial.print(leds[i]); // "1"
}
}
The issue is, the array element is not being set at all. As you can see, this is even inside of the animation class that I am having the issue. I've also tried using (leds*)[i] = 0
, but that doesn't have any effect either.
Why is it that the value is not being set in the array?