Hi,
I've been trying to combine two lighting effects with my Neopixels and after fixing a few problems with declaring variables in some lines of the code, the IDE gave me a warning message about an expression list being treated as a 'compound expression list' when I attempted to verify the sketch.
Here is my code;
#include <Adafruit_NeoPixel.h>
#define PIN 6
#define NUM_LEDS 60
// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
for(int i=60;i<5;i++) {
rainbowCycle(20);
}
colorWipe(0xff,0x00,0x00, 50);
colorWipe(0x00,0xff,0x00, 50);
colorWipe(0x00,0x00,0xff, 50);
colorWipe(0xB7,0x00,0xFE, 50);
colorWipe(0xff,0xff,0x00, 50);
colorWipe(0xff,0xA5,0x00, 50);
}
void rainbowCycle(int SpeedDelay) {
byte *c;
uint16_t i, j;
for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
for(i=0; i< NUM_LEDS; i++) {
c=Wheel(((i * 256 / NUM_LEDS) + j) & 255);
int setPixel(i, *c, *(c+1), *(c+2));
}
int showStrip();
delay(SpeedDelay);
}
}
byte * Wheel(byte WheelPos) {
static byte c[3];
if(WheelPos < 85) {
c[0]=WheelPos * 3;
c[1]=255 - WheelPos * 3;
c[2]=0;
} else if(WheelPos < 170) {
WheelPos -= 85;
c[0]=255 - WheelPos * 3;
c[1]=0;
c[2]=WheelPos * 3;
} else {
WheelPos -= 170;
c[0]=0;
c[1]=WheelPos * 3;
c[2]=255 - WheelPos * 3;
}
return c;
}
void colorWipe(byte red, byte green, byte blue, int SpeedDelay) {
for(uint16_t i=0; i<NUM_LEDS; i++) {
int setPixel(i, red, green, blue);
int showStrip();
delay(SpeedDelay);
}
}
Anyone have any ideas where I've gone wrong or if its something small that won't affect the output of the Neopixel strip?
Thanks,
Dan