Go Down

Topic: Slow response - how to improve . . ? (Read 2 times) previous topic - next topic

PaulS

A return statement says "We're done here. Go back to the caller." If you put that in the loop, on the first iteration of loop, the function will end. The remaining iterations of loop will not happen.

It really does not make sense for SoilMosture() to get data for all 4 probes, AND for you to call it 4 times.

Either it gets data for all 4 probes, and you call it once, OR, it gets data for one probe and you call it 4 times. I vote for the latter.

michinyon

If green is so popular,  why do plants absorb all the colors except green ?

AWOL

Quote
If green is so popular,  why do plants absorb all the colors except green ?

I always assumed our green sensitivity was because, as a prey animal, our ancestors would have had a significant advantage being able to distinguish things against a green background.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

GoForSmoke


If green is so popular,  why do plants absorb all the colors except green ?


If you are not a creationist, it's a matter of what worked by chance being passed down. It's not a matter of the early life being able to pick and choose.

Yellow and green are very thin slices of the light spectrum but the first light-eaters reflected violet/purple and floated in the upper layers of the sea leaving a niche below where the green ones developed. Then there was a big wipe-out that only left the green type we know today. The ancestors of those bacteria live in plant leaves.

They absorb *most strongly* in red and blue so that's the colors to spend on grow lights. But again, check on indoor grow sites. Sunlight is the best but that's because it's so strong and free.

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

taz3m

Quote

A return statement says "We're done here. Go back to the caller." If you put that in the loop, on the first iteration of loop, the function will end. The remaining iterations of loop will not happen.
Code: [Select]

int reading[4];

for (int i=0; i<4; i++)
  {
  reading[i] = analogRead(moisture_input[i]);
   return reading[i];  >> this is where i go wrong . . !!
    }



Quote
It really does not make sense for SoilMosture() to get data for all 4 probes, AND for you to call it 4 times.


i got your point here . . i been able to figure out the flaws . . . :%

Code: [Select]

int SoilMoisture() >> /* only one variable to hold out the return result, Only one result from int reading and rest of probes rendered useless !!
how to call for more   */


Quote

Either it gets data for all 4 probes, and you call it once, OR, it gets data for one probe and you call it 4 times. I vote for the latter.


i did get it here! if i need to get that data from x probes and want to call it x times, then i will need to have such a function repeated x times in my code. .                ? :. :.?
tz
.....

Go Up