So I am trying to code a program in arduino that does a task for 2 minutes and then another task for 5 mins. first one and then the other in a loop until a different condition is met.
Ive been trying to do this with if statements and while loops but im getting lost in the time part i think
//Pneumatic feed system
    double minute = 1000*60;
    double vibTime = 2 * minute;   //2 mins
    //double vibTime = 5000;
    double execTime = millis();
    double waitTime = 5 * minute; //time waits between vibrating 
    //double waitTime = 10000;
void DoPneuFeed() {
    //Serial.print("Delta:");
    //Serial.println(millis()-execTime);
    if(Temp_Data[T_9] < 500)
    {
          if(execTime + vibTime < millis())
          {
              //turn on vibration for 2 mins
              execTime = millis();
              Serial.println("VIBRATING");
          }
          if(execTime + waitTime < millis())
          {
                //turn off vibration for 5 mins
                execTime = millis();
                Serial.println("WAITING");
          }
}
    if(Temp_Data[T_9] > 500)
    {
          relayOff(3);
          relayOff(7);
    }
}
void PneuFeed()
{
  if(execTime + vibTime > millis())
  {
    //air pressure open
    relayOn(3);
    //vibrator on
    relayOn(7); 
  }
  else if(execTime + waitTime > millis())
  {
    relayOff(3);
    relayOff(7);
  }
}
I want to turn on the vibration mode for 2 mins and then turn it off for 5 mins. as long as the Temp_Data(T_9) < 500. if it is greater than 500 it should stay off.
 
    