The micros() function returns the number of microseconds from the time, the Arduino board begins running the current program. This number overflows i.e. goes back to zero after approximately 70 minutes. On 16 MHz Arduino boards (e.g. Duemilanove and Nano), this function has a resolution of four microseconds (i.e. the value returned is always a multiple of four). On 8 MHz Arduino boards (e.g. the LilyPad), this function has a resolution of eight microseconds.
micros() function Syntax
micros () ;
This function returns number of microseconds since the program started (unsigned long)
Example
unsigned long time; void setup() { Serial.begin(9600); } void loop() { Serial.print("Time:"); time = micros(); //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