0

I need to build an neopixel display on my Arduino for a project, utilizing multiple neopixel strips. My first step is to get these neopixel strips working on circuits.io. In circuits.io, they only have single ones that you can string together.

I started off with just the first neopixel, and it worked just fine. Now, after adding 5 more sets, the first one doesn't work but the rest of them do!

Here is the sketch: https://circuits.io/circuits/5073229-v2g-display

Here is my code (also in the sketch):

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif

#define NUMNUCLEARPIXELS 3
#define NUMWINDSOLARPIXELS 3
#define NUMSUBSTATIONPIXELS 3
#define NUMFACTORYPIXELS 3
#define NUMEVPIXELS 3
#define NUMHOMEPIXELS 3


Adafruit_NeoPixel nuclearpixels = Adafruit_NeoPixel(NUMNUCLEARPIXELS, 3 /*pin*/, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel windsolarpixels = Adafruit_NeoPixel(NUMWINDSOLARPIXELS, 5 /*pin*/, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel substationpixels = Adafruit_NeoPixel(NUMSUBSTATIONPIXELS, 6 /*pin*/, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel factorypixels = Adafruit_NeoPixel(NUMFACTORYPIXELS, 10 /*pin*/, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel evpixels = Adafruit_NeoPixel(NUMEVPIXELS, 11 /*pin*/, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel homepixels = Adafruit_NeoPixel(NUMHOMEPIXELS, 9 /*pin*/, NEO_GRB + NEO_KHZ800);


int delayval = 0; // delay for half a second

int windsolarbutton = 8;
int factorybutton = 2;
int evbutton = 4;
int homebutton = 7;

// the setup routine runs once when you press reset:
void setup() {
  // initialize digital pins as input or output

  pinMode(windsolarbutton, INPUT);
  pinMode(factorybutton, INPUT);
  pinMode(evbutton, INPUT);
  pinMode(homebutton, INPUT);

  nuclearpixels.begin(); // This initializes the NeoPixel library.
  windsolarpixels.begin();
  substationpixels.begin();
  factorypixels.begin();
  evpixels.begin();
  homepixels.begin();

}

// the loop routine runs over and over again forever:
void loop() {

 // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.

     for(int i=0;i<NUMNUCLEARPIXELS;i++){
     // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    nuclearpixels.setPixelColor(i, nuclearpixels.Color(0,150,0)); // Moderately bright green color.\
    nuclearpixels.show(); // This sends the updated pixel color to the hardware.
    delay(delayval); // Delay for a period of time (in milliseconds).
  }
     for(int i=0;i<NUMWINDSOLARPIXELS;i++){
    windsolarpixels.setPixelColor(i, windsolarpixels.Color(0,150,0));
    windsolarpixels.show();
    delay(delayval); // Delay for a period of time (in milliseconds). 
  }
   for(int i=0;i<NUMSUBSTATIONPIXELS;i++){
    substationpixels.setPixelColor(i, substationpixels.Color(0,150,0));
    substationpixels.show();
    delay(delayval); // Delay for a period of time (in milliseconds).
  }
   for(int i=0;i<NUMFACTORYPIXELS;i++){
    factorypixels.setPixelColor(i, factorypixels.Color(0,150,0));
    factorypixels.show();
    delay(delayval); // Delay for a period of time (in milliseconds).
  }
   for(int i=0;i<NUMEVPIXELS;i++){
    evpixels.setPixelColor(i, evpixels.Color(0,150,0));
    evpixels.show();
    delay(delayval); // Delay for a period of time (in milliseconds).
  }
   for(int i=0;i<NUMHOMEPIXELS;i++){
    homepixels.setPixelColor(i, homepixels.Color(0,150,0));
    homepixels.show();
    delay(delayval); // Delay for a period of time (in milliseconds).
  }

}

Thanks, I appreciate the help!

jmsheldon
  • 13
  • 3
  • The point of NeoPixels is that they can be daisy chained. Why are you controlling each set from a separate pin? – gre_gor May 29 '17 at 14:44
  • For context, this display is to show the flow of electricity between power plants, homes, factories, and distributed electricity production, such as solar panels on someone's house. I need to use a separate string of neopixels for each connection (a total of 6 connections with the middle one being the flow of energy between the substation). – jmsheldon May 29 '17 at 16:14

0 Answers0