Arduino - millis () function


Advertisements

This function is used to return the number of milliseconds at the time, the Arduino board begins running the current program. This number overflows i.e. goes back to zero after approximately 50 days.

millis() function Syntax

millis () ;

This function returns milliseconds from the start of the program.

Example

unsigned long time; void setup() { 
   Serial.begin(9600); 
} 

void loop() { 
   Serial.print("Time:"); time = millis();
   //prints time since program started
   Serial.println(time); 
   // wait a second so as not to send massive amounts of data
   delay(1000); 
}
arduino_time.htm

Useful Video Courses


Video

Learn to Build Advanced Embedded Systems using Arduino

65 Lectures 6.5 hours

Amit Rana

Video

Learn Arduino using simple drag and drop Blocks

43 Lectures 3 hours

Amit Rana

Video

Design 3D Printed Enclosure for Arduino Boards Fusion 360

20 Lectures 2 hours

Ashraf Said

Video

ESP32 + Arduino Interfacing: A Step by Step Course

19 Lectures 1.5 hours

Ashraf Said

Video

Make PIC microcontroller based Arduino Development Board

11 Lectures 47 mins

Ashraf Said

Video

Arduino Vs Raspberry PI Vs PIC Microcontroller

9 Lectures 41 mins

Ashraf Said

Advertisements