Neopixels all flash on until loop() starts

Status
Not open for further replies.

shadlx

Member
Hello

Not sure if this is intended behaviour but it seems odd to me. I have some WS2812B neopixels connected to pin 8 on a teensy 3.2 - using the below code the pixels flash to full after pixels.begin() and until the code gets into loop() - it appears that pixels.clear() has no effect until the loop() is reached. Am I doing something wrong??

Thanks!

Richard
Code:
#include <Adafruit_NeoPixel.h>
#define NEO_PIN            8
#define NUMPIXELS      108
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, NEO_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  // put your setup code here, to run once:

  //nothing much on
  Serial.begin(9600);
  Serial.println("hello");

  delay(2000);
  
  pixels.begin();
  pixels.clear();
  //loads of pixels on
  delay(2000);

}

void loop() {
  //pixels go out
  pixels.clear();

  pixels.show();
}
 
Apologies - I edited around and had got pixels.show() after the clear in setup but this wouldn’t do anything. It seems to not do anything until loop() starts
 
That's impossible. There's something else wrong with your code. Post the ACTUAL code that shows the problem.
 
Wouldn't say impossible but would be odd - it looks like spurious transitions are getting into the strips which may be hardware. Do you have any form of level conversion from the 3.3V Teensy to the 5V strip? Most but not all of the pixels I have run but with poor reliability driven with 3.3V.

Ugly hack to test this is to use a short (5-10) length of pixels powered via a diode, making them run at 4.5V which gives just a smidge more headroom for the signals. If that clears things up then you need to look at a full level conversion solution.
 
Wouldn't say impossible but would be odd - it looks like spurious transitions are getting into the strips which may be hardware. Do you have any form of level conversion from the 3.3V Teensy to the 5V strip? Most but not all of the pixels I have run but with poor reliability driven with 3.3V.
Good points. I had assumed (perhaps naively) that the OP had connected the hardware correctly. The Adafruit guide (if purchased from there) does mention that these are really 5V devices and using a level shifter when driving from 3.3V logic will give the best results.

OP: Did you try the examples that come with the NewPixel library? Did they work?
 
I edited around and had got pixels.show() after the clear in setup but this wouldn’t do anything.

How about using pixels.show() twice in setup()? Maybe with a short delay?

Maybe there is a very subtle bug in the library? Or some other problem needing investigation? But before I look into this, I'd really like to hear that you did try with pixels.show() in setup() with the actual code you ran.

I hope you can understand we get all sorts of problem reports here that turn out to be not reproducible without the exact code. Often very subtle details matter. So as a general rule, I do not wire up the hardware here and run real tests unless the exact code is posted. Almost every time I break that rule, it turns out to be a waste of time because the code I guess is different and fails to recreate the problem.
 
Status
Not open for further replies.
Back
Top