Hi,
Am playing with the NeoPixels. Have got example code up an running which spins the neopixels through different colors. However a little confused on how to extend this, particulary with the way it has defined the neopixel colors.
The sketch defines the colors as so
#define BLUE 5,5,190
#define WHITE 150,150,150
#define GREEN 10,180,10
and calls the following function Spin in this fashion
spin (BLUE);
void spin(int R, int G, int B) {
for(i=0; i < PIXEL_COUNT; i++) {
strip.setPixelColor(i, R,G,B);
strip.show();
delay(waitTime);
}
for(i=0; i < PIXEL_COUNT; i++) {
strip.setPixelColor(i, 0,0,0);
strip.show();
delay(waitTime);
}
}
I want to send the Photon commands to change the color, so need to set a variable equal to one of the defined colors and pass to the spin function.
However, setting the variable to Int fails ie
int lightcolor = BLUE;
I have also tried an array
int lightcolor [] = BLUE;
this fails as well.
i managed to get
int lightcolor [1,1,1] = BLUE
to pass the compiler, but it failed on the functional call
spin(lightcolor)
or
spin(lightcolor[1,1,1]}
just not sure what I am missing here with regard to how the #define declares that const and how to use it throughout the sketch
thanks