Introduction: Multiple Independent NeoPixel Rings
So I built this project to see the 12 LED Pixel working. I found this one with 16 here. And I saw this integrated bracelet , but I wanted to see how different rings, different sizes would work independent from eachother.
So instead of connecting Digital Output from one board into the Digital Input on the other board as the second picture suggests, my goal was to have one dedicated DI on each board.
Step 1: Material
Step 2: Code
I had the neon.ino to start with, this one was very straight forward, I found online and adjusting the port and the size of the ring, it worked.
I had the idea there would be the need to replicate the variables, but was not sure which ones were needed and which ones could remain as is for all the NeoPixel rings.
ORIGINAL
#include
#define PIN 2 // input pin Neopixel is attached to
#define NUMPIXELS 12 // number of neopixels in Ring
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
NEW
#include
#define PIN1 6 //connect 12 Neopixel strip to Digital PIN6
#define PIN2 13 //connect 6 Neopixel strip to Digital PIN7
#define PIN3 2 // connect 24 Neopixel ring to Digital PIN8
#define PIN4 10 // connect 16 Neopixel ring to Digital PIN9
#define PIN5 9 //
#define NUMPIXELS1 24
#define NUMPIXELS2 16
#define NUMPIXELS3 12
#define NUMPIXELS4 6
#define NUMPIXELS5 1
Adafruit_NeoPixel pixels1 = Adafruit_NeoPixel(NUMPIXELS1, PIN1, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel pixels2 = Adafruit_NeoPixel(NUMPIXELS2, PIN2, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel pixels3 = Adafruit_NeoPixel(NUMPIXELS3, PIN3, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel pixels4 = Adafruit_NeoPixel(NUMPIXELS4, PIN4, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel pixels5 = Adafruit_NeoPixel(NUMPIXELS5, PIN5, NEO_GRB + NEO_KHZ800);
neonmultiple.txt
was another code I have found, but based on adjusting buttons for the speed... I needed to merge both codes.
for the first time I used
void loop() {
ring1();
ring2();
ring3();
ring4();
ring5();
So it was easy to see all the code and variables I needed to "quadruplicate" from the original Neon.ino
The set color part I kept only once, since all the lights can randomly change, so no need to setcolor1, setcolor2... etc
void setColor(){
redColor = random(0, 255); greenColor = random(0,255); blueColor = random(0, 255); Serial.print("red: "); Serial.println(redColor); Serial.print("green: "); Serial.println(greenColor); Serial.print("blue: "); Serial.println(blueColor); }
the final code I used is called multiple_rings1.ino
Step 3: Result
can only simulate in thinkercad for now