You have a function in the code you posted called "Wheel". Look at it.
What happens when the first return statement is executed?
At the end of the function you are looking at are two statements containing the word "return".
What happens when your sketch executes the first of those "return"s?
Why doesn't it matter if there is or isn't a second "return"?
joey2point0:
See i am a total noob, i understand the concept of what you are trying to say, i just am terrible at programming. i tried looking at the examples but i still do not understand.
If the examples that they provide are too difficult to understand to you, then there is nothing I could do to help short of writing the code for you.
I have two different LED strips hooked up to the arduino, the left one and right one. does that awnser it?
No. The return keyword says "stop executing code at this point, and return this value to the caller". The function can have multiple return statements, but that only makes sense if one of them is in a conditional block, like so:
int dumb(int a, int b)
{
if(a < b)
return -1;
else
return +1;
}
Code like:
int dumb(int a, int b)
{
// Do some stuff
return -1;
return +1;
}
doesn't make sense, but, that is what you have. The function is supposed to return a value, or it is declared wrong. Two unconditional returns don't make sense.
lol, it makes sense now, but back to my real problem. is there an easy way for the push-button to be read consistently, even while the other cycles are running. and be able to stop them mid cycle and switch
is there an easy way for the push-button to be read consistently, even while the other cycles are running. and be able to stop them mid cycle and switch
Sure. Rewrite the code, first, so it does not use delay(). Then, it will be trivial to read the switch and react nearly instantaneously.
If you are having difficulty getting rid of the delay calls, think about how YOU would diddle with the LEDs, given some switches, a watch, and a pad of paper. The switches are the digital pins, the watch is the millis() function, and the pad of paper are the Arduino variables.