Check Timer Code Arduino One

Hi!
If you set a timer, how do you refer back to the time measured by the timer in the code later on? I want to trigger different functions at different times and reset the timer at certain moments, so I don't think the millis function is the best way to go. I have set a timer using

timer.setTime(HOLD_MS,false);
timer.start();

but am not sure how to "refer back to the measured time"/"check the time from the timer" later on in the code?
(maybe a stupid question, I am new at this)

Are you using a timer library? If so it would help to point at that library :slight_smile:

Hello jenna005
You can either use a ready-developed library with all the side effects or brew a time handler yourself.
Up to you.
Have a nice day and enjoy coding in C++.

the millis() Returns the number of milliseconds passed since the Arduino board began running the current program.
You set up counters (long int) to time the events and check them against the millis() time

unsigned long int

In general, using a millis() timer is:

  // Start a local timer.
  static unsigned long startTime = millis();

  // Calculate elapsed time.
  unsigned long elapsedTime = millis() - startTime;

  // Has the timer reached some limit?
  if (millis() - startTime >= interval)

  // Re-start the timer
  startTime = millis();