Arduino – millis () function

milliseconds

This function is used to return the number of milliseconds at the time, the Arduino board begins running the current program. This number overflows i.e. goes back to zero after approximately 50 days.

millis() function Syntax

millis () ;

This function returns milliseconds from the start of the program.

Example

unsigned long time; void setup() { 
   Serial.begin(9600); 
} 

void loop() { 
   Serial.print("Time:"); time = millis();
   //prints time since program started
   Serial.println(time); 
   // wait a second so as not to send massive amounts of data
   delay(1000); 
}

Previous Page:-Click Here

Leave a Reply