Hi everyone! I have a newbie question that gets mangled when I search for the answer.
I am wondering what the argument (10) is that is in the following: rainbowCycle(10). With this argument ther are numbers between the parenthesis, however in other arguments that I have found, sometimes they are just blank (). Adjusting the number inside, at first, led me to believe it was that the timing for the rate of color change. However it seemed to max out at rainbowCycle(1000). In the code shown below, initially there was a delay (wait) towards the bottom of the code. By defining a time t, and inserting it instead of the wait, I was able to increase the cycle times to values greater than 1000. With that said, the meaning of the (10) in the rainbowCylce(10) has again been lost to me. Once I used the defined timing, leaving the argument blank rainbowCycle() though gives me a compiling error. And when leaving any number inbetween, different values seemed to have no effect.
So my questions are, What is this specific argument rainbowCycle()? and In the future is there a place to quickly look up what type of value goes in the parenthesis for an argument?
Thanks,
Matt
#include <Adafruit_NeoPixel.h>
#define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(22, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
//rainbowCycle(color rate of change???) <---Cycles rainbow colors down through all pixels??? MMM
rainbowCycle(10);
}
// Rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
uint16_t i, j;
int t= 8; //Sets time delay for changing color MMM
for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
for(i=0; i< strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
}
strip.show();
delay(t);
}
}
// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
if(WheelPos < 85) {
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
} else if(WheelPos < 170) {
WheelPos -= 85;
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
} else {
WheelPos -= 170;
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
}