XRAD'S How to pass an array value to a function argument

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;  
}

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]) {

single value at a time. thank you!!!! so simple now. ...... :face_with_rolling_eyes:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.