A 1 is a long high followed by a short low, 0 is a short high followed by a long low.
The specified longs are not equal to each other nor are the shorts. But both 1 and 0 add up to about the same. There is quite a bit of flexibility in the exact timing.
And we know the much longer low that follows the data is the signal to move collected RGB data to the driving circuitry, more or less all at once.
Here's what four neopixels data looks like:
And at the end, we can see that they arrive at the end of their last pulse at different times:
Pixel 1 actually beats Pixel 0. This is because, I think, each neopixel reforms and passes on the digital data. At that point, the long/shorts are no longer what the code dictated, they are what the previous pixel (re)produced. It can pass along a pulse as soon as it knows it is long or short, which can be before the input goes low.
We can also see that it takes some time for later pixels. My cheap 24 MHz logic analyser is inadequate, but we can see def latency introduced by each pixel of something like 167 ns, so with only this crude data, in a 100 pixel strip we can say the last pixel will change its output 16.7 us later than the first.
Compared to the rippling data speed driven updating of the APA102 (I think, experiments later), this is not too shabby.
What I cannot explain is the 308 us I observed from the end of the first strip.show() to the beginning of the next. The first strip.show() starts 10 us after the trigger, the trigger goes low 15 us after the last pulse of the second strip.show() so what is going on for 300 us between the two which are just two lines of code?
Here's the testing code:
// stimulate the strip for logic analyser
# include <Adafruit_NeoPixel.h>
# define PIN 7
# define NLAMPS 4
# define TRIGGER 8
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NLAMPS, PIN, NEO_GRB + NEO_KHZ800);
void setup()
{
Serial.begin(115200);
pinMode(TRIGGER, OUTPUT);
strip.begin();
strip.clear();
strip.show();
delay(100);
if (1) colors();
else strip.clear();
Serial.println("gonna");
for (; ; ) {
digitalWrite(TRIGGER, HIGH);
strip.show();
strip.show();
digitalWrite(TRIGGER, LOW);
delayMicroseconds(100);
Serial.println("did");
static int counter;
counter++;
if (counter % 100 == 0) {
strip.clear();
strip.show();
delay(500);
colors(); // right?
}
}
}
void colors()
{
strip.setPixelColor(0, 0x10001f); // blue
strip.setPixelColor(1, 0x00220f); // green
strip.setPixelColor(2, 0x23000f); // red
strip.setPixelColor(3, 0x13131f); // grey
}
void loop(){}
Fun!
a7