Some questions about millis()

Hello,

You can’t reset millis().
You can start a time elapsed counter that counts from the time started.

A simple example:

int timeStart;
int timeElapsed;

void setup() 
  {
  timeStart = millis();
  }

void draw() 
  {
  timeElapsed = millis() - timeStart;
  println(timeElapsed);
  }

void keyPressed()
  {
  timeStart = millis();  //Resets time elapsed counter
  }

:)

Other millis() examples here:

1 Like