Connect Arduino Uno to 2xNeopixels with pushbutton switch

Hello Everyone,

I'm pretty new to the world of Arduino and I hope I'm posting in the right section.

I'm trying to complete a very simple project: 2 Adafruit Neopixel rings (24 led each) connected to an Arduino Uno that turn on and off with a pushbutton switch. One push the rings stay on, one push they stay off. The rings should not change and be a specific RGB colour.

I've started with the coding of the first ring (hoping it makes sense):

#include <Adafruit_NeoPixel.h>
#define LED_PIN    6
#define LED_COUNT 24
Adafruit_NeoPixel pixels(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup() {

pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)

pixels.setBrightness(55);
pixels.show();
for(int i=0; i<LED_COUNT; i++)
pixels.setPixelColor(i, pixels.Color(62, 6, 148));
}

void loop() {

pixels.show();
}

but when it comes to connect the pushbutton and the resistor in the circuit I get lost! I've been looking everywhere for a similar project but everything seems to be slightly different and not very helpful for this project in particular.

Would anyone be able to help with the circuit? If I follow the connection from positive to negative at what point do I interrupt it with a push button? And how do I connect that to the correct pin on the Arduino?

Thank you

Would anyone be able to help with the circuit?

No need to even draw a picture. The switch has two legs. Connect one to ground. Connect the other to a digital pin. Set the pin mode to INPUT_PULLUP.

I've started with the coding of the first ring

If I were writing code to control two rings, I'd name the class instances ring1 and ring2. I fail to see any reason for you not to do the same.

If both rings are going to behave the same, do you even need 2 instances?
I would think one instance, and connect both rings to the same pin.

vinceherman:
If both rings are going to behave the same, do you even need 2 instances?
I would think one instance, and connect both rings to the same pin.

That was my first thought, too. But, I'm sure that the requirements will change as soon as the OP discovers that the rings can do more than light up one specific color.

Another thought... Don't those rings have another pin to daisy chain more rings?
Still one data pin from the arduino, but drive a string of twice as many individual pixels?

vinceherman:
Another thought... Don't those rings have another pin to daisy chain more rings?
Still one data pin from the arduino, but drive a string of twice as many individual pixels?

Believe me. At this point, don't introduce the idea of daisy chaining them.

-jim lee