const int timeInterval1 = 2300; // Time between events in milliseconds
unsigned long timeNow1 = 0; // Timestamp for when the event was executed

const int timeInterval2 = 4200; // Time between events in milliseconds
unsigned long timeNow2 = 0; // Timestamp for when the event was executed

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  timedEvent1();
  timedEvent2();
}

void timedEvent1()
{
  // Is it time to execute the event code?
  if (millis() - timeNow1 >= timeInterval1)
  {
    Serial.println("Timed event 1 occurred");

    // Update the timestamp with the time at which the event was executed
    timeNow1 = millis();
  }
}

void timedEvent2()
{
  if (millis() - timeNow2 >= timeInterval2)
  {
    Serial.println("Timed event 2 occurred");

    timeNow2 = millis();
  }
}