User Tools

Site Tools


arduino:time:micros

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

arduino:time:micros [2024/02/16 01:04] (current)
Line 1: Line 1:
 +======micros()   ======
 +
 +====Description   ====
 +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.  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.
 +
 +''Note'': there are 1,000 microseconds in a millisecond and 1,000,000 microseconds in a second.
 +
 +====Parameters   ====
 +None
 +
 +====Returns   ====
 +Number of microseconds since the program started (''unsigned long'')
 +
 +====Example   ====
 +
 +<code arduino>
 +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);
 +}
 +</code>
 +
 +====See also   ====
 +* [[arduino:time:Millis]]
 +* [[arduino:time:Delay]]
 +* [[arduino:time:DelayMicroseconds]]
 +
 +
 +Source: arduino.cc
  

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
arduino/time/micros.txt · Last modified: 2024/02/16 01:04 (external edit)

Impressum Datenschutz