Basic Library
Digital I/O
Analog I/O
Advanced I/O
Time
Math
Trigonometry
Random Numbers
Bits and Bytes
Interrupts
Serial Comm.
Standard Library
Camera
Servo Motor
Stepping Motor
Character LCD
SPI
I2C (Wire)
SD Card
SD (File Operations)
Periodic Operation
Clock (RTC)
Mbed Tips
Time
This library waits for and/or measures the specified time.
millis
- Description
- Returns the number of milliseconds since the GR-LYCHEE board began running the current program. This number will overflow (go back to zero), after approximately 50 days.
- Syntax
- unsigned long millis()
- Parameters
- None
- Returns
- Number of milliseconds since the program started (unsigned long)
micros
- Description
- Returns the number of microseconds since the GR-LYCHEE board began running the current program. This number will overflow (go back to zero), after approximately 70 minutes.
- Syntax
- unsigned long micros()
- Parameters
- None
- Returns
- Number of microseconds since the program started (unsigned long)
delay
- Description
- Pauses the program for the amount of time (in milliseconds) specified as parameter.
- Syntax
- delay(unsigned long ms)
- Parameters
- ms: The number of milliseconds to pause
- Returns
- None
delayMicroseconds
- Description
- Pauses the program for the amount of time (in microseconds) specified as parameter.
- Syntax
- delayMicroseconds(unsigned long us)
- Parameters
- us: The number of microseconds to pause
- Returns
- None
Sample Program
Displays the time since program start in 100ms intervals via serial communications.
#include <Arduino.h>
#define INTERVAL 100
unsigned long val_time;
void setup()
{
Serial.begin(9600);
}
void loop()
{
val_time = millis();
Serial.println( val_time );
delay(INTERVAL);
}