I’ve been playing around with the neopixel library and appear to have run into an odd result.
If I set the brightness down from 100% and then run ,strip.getPixelColor(i-1) the color returned appears to be the dimmed value.
Which if you then use is re-dimmed.
So lines such as:
strip.setPixelColor(i,strip.getPixelColor(i-1));
won’t work to copy a pixels color to the next pixel.
This is different to how the Adafruit Library works which returns the pre-dimmed value so when it is reapplied the resulting color is correct.
NeoPixel library setBrightness call causes getColor to always return zero if used early.
Me too. I think this is the same(ish) issue?
If you use setBrightness to set a 50% value (127) as in this fragment…
.
.
const uint8_t MAX_BRIGHTNESS=127; // Sets the maximum brightness value to 50%
LEDS.setBrightness(MAX_BRIGHTNESS);
.
.
straight after you have initialised (in this case) LEDS - then if you read any pixel value, it always returns zero - even if you write non-zero values into it first. Same happens if you just use a numeric value in the setBrightness call rather than a const.
Omit the setBrightness call and it all behaves correctly. I’m guessing this is some issue with the sparkcore port of the Neopixel library. Not a huge problem for me - I can work around this limitation, but I have wasted a fair few hours trying to figure out the details of this - so hope this saves someone else that time.