Closed pzich closed 7 years ago
+1
typo? NUMPIXELS-5
should be 0
?
#include <Adafruit_DotStar.h>
#include <SPI.h>
#define NUMPIXELS 72 // 73
#define DATAPIN 11
#define CLOCKPIN 13
Adafruit_DotStar strip = Adafruit_DotStar(NUMPIXELS, DATAPIN, CLOCKPIN);
void setup() {
strip.begin();
}
boolean flash = false;
void loop() {
for(int i = 0; i<NUMPIXELS; i++)
strip.setPixelColor(i, flash ? 0xFF0000 : 0x0000FF);
strip.show();
// strip.show();
delay(500);
flash = !flash;
}
As I say, "demonstrates this by toggling the last 5 LEDs in a strip", depending on the length of the strip and how it's powered, you may not be able to drive the full length of LEDs, but the issue is with the end of the strip.
@pzich oops! Im assuming youre still having this issue? Im getting the same result using the Fast LED library as well.
I'm seeing similar problems where the last few LEDs on my strip don't update properly unless I call strip.show() twice.
I have about 320 LEDs on my strip, and I'm powering it at both ends, and at two points in the middle.
The last few LEDs on my strip work more frequently if I use the hardware SPI mode.
I have seen where the first few pixels were very noisy (wrong colors); and others beyond sometimes would light poorly; but this turned out to be dodgy IO connection (both a solder joint to the strip, and a alligator clip that was a little corroded) which drove me crazy for a day.
Even with the fix above I am seeing problems where the terminator bytes were showing up at the end of the strip. If I have a physical strip of 30, but I code for only 25, then the 26th LED will light as white.
This is due to the terminator (oxffffffff) is the same as a full white (oxffffffff). So the terminator has no real magic behind it all otherwise a full white pixel earlier in the strip would cause problems.
If you don't send the terminator at all, then it doesn't effect the update of the pixels at all. I continue to see all the pixels get updated AND each pixel visually shows its status when it decodes its own data.
I ran into the link above, but I can't confirm anything it states to be valid and it is not what I see; so either the DotStars have changed (mine are pretty new) or they missed something in their investigation.
I just recently got a strip of DotStar LEDs, and noticed while programming a strip to flash between two colors that if I set the length to the number of LEDs and periodically called
strip.show()
with alternating colors, the last LED always seemed to be out of sync. Two workarounds that seemed to work was making the strip an extra LED longer or callingstrip.show()
twice (as commented below). I've attached a brief example that demonstrates this by toggling the last 5 LEDs in a strip (adjustNUMPIXELS
to the strip you use).