Arduino Millis function explained with 3 examples

Project Video
Project Details

This code example has been explained in video. Please watch the video and use this code.

See Example 2 of using millis() in Arduino programming

Project Code

 * Example-1 of using millis() with Arduino
 * Written by Ahmad Shamshiri on July 27, 2019
 * in Ajax, Ontario, Canada
 * Watch video instruction for millis() :

unsigned long event = 5000;// 5 seconds
void setup() {
  Serial.begin(9600);//initialize serial monitor
  Serial.println("Introduction to millis");

void loop() {
  // millis() example 1
  int pb = digitalRead(2);// read pin 2
  if(pb ==LOW)
      if(millis() >= event)
        Serial.println("Take action");
      }// if end
  }// if end
}// loop end

If you found this Arduino course helpful, please support me so I can continue creating content like this. support me via PayPal