Micros()

From Microduino Wiki
Revision as of 06:40, 12 August 2016 by Fengfeng (talk) (Created page with "micros() *'''Description''' Return the number of microseconds of Arduino development board starting from running the current program. This number will overflow (return to z...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

micros()

  • Description

Return the number of microseconds of Arduino development board starting from running the current program. This number will overflow (return to zero) after about 70 minutes. In 16MHz microduino development board(for example core+644 16M ), the resolution of this function is 4 microseconds(that is to say the return value is always in multiples of 4).

In 8MHz Arduino development board(for example core328 8M), the resolution of this function is 8 microseconds.

Note:1 Millisecond is 1,000 microseconds, and 1 second is 1,000,000 microseconds.

  • Parameter

No

  • Return

Return the number of microseconds (unsigned long integer)from running the current program.

  • Example

unsigned long time;
 
void setup(){
     Serial.begin(9600);
}
void loop(){
Serial.print(“Time:”);
time = micros();
//print the time from the program
Serial.println(time);
//wait for a second to avoid sending quantities of data
     delay(1000);
}

[Return to Arduino Syntax Manual]