XRAD
1
Trying to pass an array value to the second argument of a function. Anyone with some suggestions? Thank you in advance...
int MillisTimers[5] = {800, 1000, 1500, 2000, 2500};
boolean FunctionForThisTime(unsigned long &startOfPeriod, ***MillisTimers[]**) {
unsigned long currentMillis = millis();
if (currentMillis - startOfPeriod >= **MillisTimers[**]) {
startOfPeriod = currentMillis;
return true;
} else return false;
}
b707
2
Please clarify your question - do you need to pass a single array element or entire array?
For a single value:
boolean FunctionForThisTime(unsigned long &startOfPeriod, int timer) {
unsigned long currentMillis = millis();
if (currentMillis - startOfPeriod >= timer) {
startOfPeriod = currentMillis;
return true;
} else return false;
}
and using:
if (FunctionForThisTime(start_period, MillisTimers[2]) {
XRAD
3
single value at a time. thank you!!!! so simple now. ...... 
system
Closed
4
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.