Hello, I can't figure this out nor do I know if it's even possible.
Here is my delima....
I have a segment like below
Void ledprogram(xyz) (number of case desired, case one RGB follow, case 2 flash ect)
However I have a few cases that need more variables like color, speed.
What I'm trying to do is when input the first part ledprogram(2) it works fine. But how can I make it where if I choose 3 instead of 2 the variables for 3 need to passed. So case 3 needs additional information where case 2 doesn't
I was thinking like if led program 3 is called that selection can be 0assed to another case that has the variables already done.
I'm really stuck here I appreciate any help provided and please don't think I'm dumb :=)
i think when you wrote "segment" you mean "function"
and i'm not sure if by "case" you mean argument.
in the example below, you can define a function with default argument values. in the case below, the function can be called with 1 or 2 arguments. if you specify just one argument, the 2nd argument has a default value of zero
void
myFunc (
int arg1,
int arg2 = 0)
{
printf (" %s: %d %d\n", __func__, arg1, arg2);
}
this example runs on my laptop where printf() can be used
Sorry for my bad terms. Im lost on your example. let me add some code in to make better sense.....
void ledsprogram(0, effect, bright) {
EEPROM.put(0, effect);
FastLED.setBrightness(bright);
switch(effect) {
case 0 : {
RGBLoop();
break;
}
Now i need to pass the effect variable to
EEPROM.get(0, effect);
FastLED.show then from what every value effect is , i need to take that value and use it to do another case list (like one above) which has the variable (speed, fade, ect.) already filled out, Is this making sense?