Returns the number of microseconds since the Arduino board began running the current program. This number will overflow (go back to zero) after approximately 70 minutes.
This timing function offers various resolutions compatible with different Arduino families.
Use the following function to get the exact time the board has been running the current program in microseconds:
micros()
This function does not admit parameters.
This function returns the number of microseconds since the Arduino board began running the current program. Data type: unsigned long.
The code returns the number of microseconds since the Arduino board began running the current program.
unsigned long time;
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.print("Time: ");
time = micros();
Serial.println(time); //prints time since program started
delay(1000); // wait a second so as not to send massive amounts of data
}
There are 1,000 microseconds in a millisecond and 1,000,000 microseconds in a second.