Arduino with Neo_Pixel60

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
jmrtz79
 
Posts: 4
Joined: Wed Oct 09, 2013 7:15 pm

Arduino with Neo_Pixel60

Post by jmrtz79 »

After looking at many sample codes and other people project codes, i was able to somehow hack together codes to make my own show. (A simple firework looking show)
Now I'm stump. :(

But before i get ahead, this is the hardware I'm using:
1x Arduino Uno r3 and
5x 5 meters of Neo_Pixel 60 Digital RGB LED Strips
1x 450W Computer Power Supply

What I'm stuck at is that i want to run (if it's even possible) the same show using 1 Arduino Uno with 5 outputs (one output at a time), each output will be connected with a 5 meter LED strip.

Please help me to the right path.

Code: Select all


#include "FastSPI_LED2.h"

#define NUM_LEDS 255 //Total LEDs of strand
#define DATA_PIN 6  // Data pin that led data will be written out over

CRGB leds[NUM_LEDS];


int thisdelay = 1;          //-FX LOOPS DELAY VAR
int thissat = 255;           //-FX LOOPS DELAY VAR
int idex = 0;                //-LED INDEX (0 to LED_COUNT-1
int ihue = 0;                //-HUE (0-255)



void setup() {
  
        // sanity check delay - allows reprogramming if accidently blowing power w/leds
   	delay(2000);
   
        FastLED.addLeds<WS2811, DATA_PIN, GRB>(leds, NUM_LEDS);
        one_color_all(0,0,0); //-CLEAR STRIP
        FastLED.show();
}

void loop() { 
	for(int i = 0; i < 6; i++) {
		for(int iLed = 0; iLed < 60; iLed++) {
			memset(leds, 0,  NUM_LEDS * sizeof(struct CRGB));

			switch(i) { 
				// You can access the rgb values by setting the rgb values for the pixel all at once
			 	case 0: leds[iLed] = CRGB(255, 50, 0); break;
                                case 1: one_color_all_1(255,0,0); break;  //-SET FIRST RING TO ONE COLOR
                                case 2: one_color_all_2(0,255,0); break;  //-SET SECOND RING TO ONE COLOR
                                case 3: one_color_all_3(0,0,255); break;  //-SET THIRD RING TO ONE COLOR
                                case 4: random_color_pop4(); break;       //ALL RINGS-RANDOM COLOR POP
                                case 5: one_color_all(0,0,0); break; //-CLEAR STRIP

			}

			// and now, show your led array! 
			FastLED.show();
			delay(1);
		}


           delay(1);

	}
delay(2000);
}


void random_color_pop4() {                         //ALL RINGS-RANDOM COLOR POP
  idex = random(60, 255);
  ihue = random(0, 200);
  one_color_all(0, 0, 0);
  leds[idex] = CHSV(ihue, thissat, 255);
  FastLED.show();
  delay(1);
}

void one_color_all(int cred, int cgrn, int cblu) {       //-SET ALL LEDS TO ONE COLOR
    for(int i = 0 ; i < NUM_LEDS; i++ ) {
      leds[i].setRGB( cred, cgrn, cblu);
    }
}

void one_color_all_1(int cred, int cgrn, int cblu) {       //-SET FIRST RING TO ONE COLOR
    for(int i = 60 ; i < 75; i++ ) {
      leds[i].setRGB( cred, cgrn, cblu);  
    }
}

void one_color_all_2(int cred, int cgrn, int cblu) {       //-SET SECOND RING TO ONE COLOR
    for(int i = 75 ; i < 135; i++ ) {
      leds[i].setRGB( cred, cgrn, cblu);  
    }
}

void one_color_all_3(int cred, int cgrn, int cblu) {       //-SET THIRD RING TO ONE COLOR
    for(int i = 135 ; i < 255; i++ ) {
      leds[i].setRGB( cred, cgrn, cblu);   
    }
}

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Arduino with Neo_Pixel60

Post by adafruit_support_rick »

I'm not familiar with the FastSPI_LED2 library. But if you want five different outputs, you're going to have to declare five separate instances of the FastLED object - one for each output pin.

However, I don't see any declaration of FastLED, so it must be declared in FastSPI_LED2.h. Therefore, it's possible that the library can only support a single instance.

jmrtz79
 
Posts: 4
Joined: Wed Oct 09, 2013 7:15 pm

Re: Arduino with Neo_Pixel60

Post by jmrtz79 »

Thank you Rick for the response.

If the library might be problem, you think it might be better to get a total of 5 arduinos and load up each with the same show and then daisy-chain them.
When one arduino runs the show and finish then, somehow, it activates the next arduino and so on then loop back to the first arduino.
Is this even possible?
If it is, how would the coding be.

I'm new to coding (total Noob) and to arduino.
I just copy/paste different codes together, change different values until i got a show working. (I have no idea what each command mean, that's how new I am to coding)

If you or anybody else have a better solution to this, I'm all ears and welcome all the help I can get.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”