what is the argument

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);
  }
}

In the future is there a place to quickly look up what type of value goes in the parenthesis for an argument?

You have the source for the library - that's where you should look first.

In the code shown below, initially there was a delay (wait) towards the bottom of the code

By removing delay(wait); from the function you have also removed the effect of passing any parameter to the function because it is not used.

(uint8_t wait) in the function definition indicates that it is expecting an unsigned 8 bit int as the parameter and that within the function it will be known as wait. The code will not compile if you do not call the function with anything as the parameter because it is defined as needing one.

void rainbowCycle(uint8_t wait) {

Calling rainbowCycle(1000) is not going to work as intended because you can't cram 1000 into a uint8_t.

Pete

I think I have got it. Thanks everyone. The (uint8_t wait) is set in the rainbowCycle() and defines an 8bit value for time t which then defines the wait time. I am assuming that a (uint16_t wait) sets up a 16bit time for the wait time.

Thanks again,
Matt