Probably an embarrassingly simple question -- but I'm more interested in knowledge than pride.

fastled-support
gplus
(allanGEE) #1

Probably an embarrassingly simple question – but I’m more interested in knowledge than pride. :slight_smile:

Typically, when calling functions in a void loop, I see the following format…

void loop()
{
marqueeWhite();
}

But on occasion, I’ve seen a value in the parentheses, like so…

void loop()
{
marqueeWhite(30);
}

Can someone tell me what that number does?

Thanks!

(M K) #2

Not sure what the marqueeWhite() method does, but the number seems to be an optional parameter.

example:

void setBrightness(int t=100){
 // do something
}

if you now call
setBrightness()
it would be the exact same call as if you would call
setBrightness(100)
And should set the brightness to 100%.
The call
setBrightness(30)
should set the Brightness to 30%

So what is actually happening with the number is defined in the method itself. If you see it in the source code, you will see what the default value is.

(Marc Miller) #3

@allanGEE It can be quite useful once you understand this. :slight_smile:

https://www.arduino.cc/en/Reference/FunctionDeclaration

(allanGEE) #4

@marmil Great… now a bunch of interesting stuff that I should NOT read while at work! :wink: Thanks for the links!

(Thomas “Balu” Walter) #5

@allanGEE unless your work is Arduino programming, then you probably should :wink: