Neopixel Code When Using 2 Neopixels on Separate Pins

I am building a small lighting controller to power 2 separate wall lamps that have been fitted with neopixel rings. The idea is to run the 2 lights from a Trinket 5v and have one pin (0) control one light and one pin (1) control the 2nd light. Currently the code I have done is very basic to prove that everything is working. The code does in fact turn on both neopixels but all LED’s on each ring is solid white despite the code specifying something different. Anybody have any thoughts on what I am doing wrong?

Here is my code:

#include <Adafruit_NeoPixel.h>
#ifdef AVR
#include <avr/power.h>

#define PIN 0
Adafruit_NeoPixel ring_a = Adafruit_NeoPixel(12, 0); //Define PIN 0 parameters.

#define PIN 1
Adafruit_NeoPixel ring_b = Adafruit_NeoPixel(12, 1); //Define PIN 1 parameters.

void setup() {
ring_a.begin();; // Intialize all pixels to “off”

ring_b.begin();; // Intialize all pixels to “off”

void loop() {

ring_a.setPixelColor(11, 255, 0, 255, 0); //set pixel 11, neopixel ring 0 color
ring_a.setPixelColor(9, 150, 50, 150, 0);//set pixel 9, neopixel ring 0 color
ring_b.setPixelColor(0, 100, 100, 100, 0); //set pixel 0, neopixel ring 1 color
ring_b.setPixelColor(3, 50,50,50, 0); //set pixel 6, neopixel ring 1 color; //Sends updated pixel color information.; //Sends updated pixel color information.

You don’t need the repeated #define PIN since you hardwired the PIN number in the constructor call

Which type of strip do you have ? If you're using RGBW strips then indeed the call is ring_a.setPixelColor(n, red, green, blue, white); but otherwise just ring_a.setPixelColor(n, red, green, blue);

The last optional argument is for white, which will only be used if the strip was defined during creation as an RGBW type and the strip actually is RGBW type. (which you did not declare that way)

The idea is to run the 2 lights from a Trinket 5v ...

Just for clarification... you are not trying to run these neopixel rings from the trinket's 5v are you ?

The code does in fact turn on both neopixels but all LED's on each ring is solid white

Are you sure it is the code lighting the LEDs ? (they can light up white on their own before you give them a signal)

Have you managed to turn the LEDs ON and OFF in code ?


J-M-L - Thank you for pointing out the redundant PIN calls. I will work on fixing that. Also, thanks for noticing the "White" LED. I had added that trying to get it to work and also called that in the Neopixel parameters and then later removed the parameters and forgot to remove the additional color calls.

Tony - I am not running the power off of the Trinket 5v directly, I am using a separate 5v power supply. As for the ON and OFF. I had not thought of that. Didn't actually realize that the LEDs could light up with a signal. I will try to write something that makes them turn on and off and start there. Thanks for the reply.

I will try these suggestions and repost the results.

You might also try setting all the colors for one instance and then show()ing that instance before setting the colors, and show()ing the other instance.

Finally, make sure that you can actually use pins 0 and 1 for what you want, on the Trinket.