Central Wisconsin
Offline
Newbie
Karma: 0
Posts: 23
|
 |
« Reply #15 on: April 25, 2012, 09:13:29 am » |
return(RightStrip.Color(r,g,b)); return(LeftStrip.Color(r,g,b)); Hmm ???
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #16 on: April 25, 2012, 09:14:47 am » |
??? That's exactly what I thought too.
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Central Wisconsin
Offline
Newbie
Karma: 0
Posts: 23
|
 |
« Reply #17 on: April 25, 2012, 09:36:31 am » |
I am not very familiar with that.
Familiar with what? EEPROM? It's not complicated at all and there are examples you can look at that will explain it. 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.
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 316
Posts: 35566
Seattle, WA USA
|
 |
« Reply #18 on: April 25, 2012, 09:43:09 am » |
Look at your Wheel() function. What happens when the first return statement is executed? How many values can you return from a function (using the return statement)?
|
|
|
|
|
Logged
|
|
|
|
|
Central Wisconsin
Offline
Newbie
Karma: 0
Posts: 23
|
 |
« Reply #19 on: April 25, 2012, 09:51:52 am » |
Look at your Wheel() function. What happens when the first return statement is executed? How many values can you return from a function (using the return statement)?
im sorry, i have no idea what you are talking about
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #20 on: April 25, 2012, 09:58:18 am » |
Look at your Wheel() function. 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"?
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Central Wisconsin
Offline
Newbie
Karma: 0
Posts: 23
|
 |
« Reply #21 on: April 25, 2012, 10:03:33 am » |
I have two different LED strips hooked up to the arduino, the left one and right one. does that awnser it?
|
|
|
|
|
Logged
|
|
|
|
|
California
Offline
Edison Member
Karma: 41
Posts: 1883
|
 |
« Reply #22 on: April 25, 2012, 10:15:59 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 316
Posts: 35566
Seattle, WA USA
|
 |
« Reply #23 on: April 25, 2012, 10:20:20 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Central Wisconsin
Offline
Newbie
Karma: 0
Posts: 23
|
 |
« Reply #24 on: April 25, 2012, 10:33:16 am » |
I took one of the Return() functions out and it seems to work the same.
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 316
Posts: 35566
Seattle, WA USA
|
 |
« Reply #25 on: April 25, 2012, 10:36:02 am » |
I took one of the Return() functions out and it seems to work the same. Does that surprise you? The other one was never being executed, anyway. Removing it should have had no impact.
|
|
|
|
|
Logged
|
|
|
|
|
Central Wisconsin
Offline
Newbie
Karma: 0
Posts: 23
|
 |
« Reply #26 on: April 25, 2012, 10:40:08 am » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 316
Posts: 35566
Seattle, WA USA
|
 |
« Reply #27 on: April 25, 2012, 10:45:46 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
|