Ok, I am a terrible communicator I will try to be clear : )
I was trying to do one strip but I could not clear some of the error codes I was getting by myself. As a result I used the first method of multiple pins and separated the strips accordingly.
I felt my code was taking up to much space so I only pasted what I thought was the important part and then neglected to tell you
I like the versatility of the multiple pin method, because I can understand the code (I guess enough , for future use) and I can switch between lighting effects. My entire code that I came up with for this is below. My dilemma is that I cannot call the "sparkle2" effect...? I do see that in the color wipe code there is a specific need to specify which strip, but I could not figure out how to specify which sparkle effect.
As of now the sequence lights up like this
-colorWipe1 on strip1, then off
-delay, no activity on strip2 (and seems like a delay for the duration of the sparkle2 effect)
-colorWipe2 on strip2, then off
-sparkle1 on strip1, then loop
How can I call the Sparkle effect for a specific strand in the loop?
#include <Adafruit_NeoPixel.h>
#define NUM_LEDS 15
#define PIN1 6
#define PIN2 5
Adafruit_NeoPixel strip1 = Adafruit_NeoPixel(NUM_LEDS, PIN1, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip2 = Adafruit_NeoPixel(NUM_LEDS, PIN2, NEO_GRB + NEO_KHZ800);
void setup() {
strip1.begin();
strip1.show(); // Initialize all pixels to 'off'
strip2.begin();
strip2.show(); // Initialize all pixels to 'off'
}
//***************************************
void loop() {
colorWipe1(strip1.Color(0, 0, 200), 60); // Blue
colorWipe1(strip1.Color(0, 0, 0), 0); // none
delay(2000);
for(int i=0; i<300; i++){
Sparkle2(0xff, 0xff, 0xff, 10);} // Cant get this to activate ??
colorWipe2(strip2.Color(0, 255, 0), 60); // Green
colorWipe2(strip2.Color(0, 0, 0), 0); // none
delay(2000);
for(int i=0; i<300; i++){
Sparkle1(0xff, 0xff, 0xff, 20);}
}
//**************** EFFECTS*******
//SPARKLE 1
void Sparkle1(byte red, byte green, byte blue, int SpeedDelay) {
int Pixel = random(NUM_LEDS);
setPixel(Pixel,red,green,blue);
strip1.show();
delay(SpeedDelay);
setPixel(Pixel,0,0,0);
}
//SPARKLE 2
void Sparkle2(byte red, byte green, byte blue, int SpeedDelay) {
int Pixel = random(NUM_LEDS);
setPixel(Pixel,red,green,blue);
strip2.show();
delay(SpeedDelay);
setPixel(Pixel,0,0,0);
}
//COLOR WIPE 1
void colorWipe1(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip1.numPixels(); i++) {
strip1.setPixelColor(i, c);
strip1.show();
delay(wait);
}
}
//COLOR WIPE 2
void colorWipe2(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip2.numPixels(); i++) {
strip2.setPixelColor(i, c);
strip2.show();
delay(wait);
}
}
//********************************
void showStrip() {
#ifdef ADAFRUIT_NEOPIXEL_H
// NeoPixel
strip1.show();
#endif
#ifndef ADAFRUIT_NEOPIXEL_H
// FastLED
FastLED.show();
#endif
}
void setPixel(int Pixel, byte red, byte green, byte blue) {
#ifdef ADAFRUIT_NEOPIXEL_H
// NeoPixel
strip1.setPixelColor(Pixel, strip1.Color(red, green, blue));
#endif
#ifndef ADAFRUIT_NEOPIXEL_H
// FastLED
leds[Pixel].r = red;
leds[Pixel].g = green;
leds[Pixel].b = blue;
#endif
}
void setAll(byte red, byte green, byte blue) {
for(int i = 0; i < NUM_LEDS; i++ ) {
setPixel(i, red, green, blue);
}
showStrip();
}