Arduino

How to Delay 1 Minute in Arduino?

Arduino is a programmable microcontroller board. It is very useful for both hardware and software development in electronics projects. Arduino can perform multiple functions through programming. Adding delay while programming the Arduino is a key task. In this tutorial, we will learn to add a 1-minute delay in Arduino.

How to Delay 1 Minute in Arduino?

Arduino delay function performs the function of pausing the execution for the time interval set by the user. The syntax of the delay function is delay(). The time interval for the delay is given in milliseconds. Therefore, to set the time for the delay you would have to multiply the required number of minutes by 60000 to convert it into milliseconds. If you want to delay in seconds, then you will have to multiply the required number of seconds by 1000 to convert it into milliseconds. You have to keep in mind that the delay() function only accepts integer values, so you cannot enter any other value.

Example of Delaying 1 Minute in Arduino

Given below is a practical example of delaying one minute in Arduino. A delay of 1 minute is set in the example which is equal to 60000 milliseconds. Arduino will delay the execution of commands for 1 minute before restarting the loops. For this purpose, a code and its hardware simulation are given.

Code

In the code given below, pin 13 is defined as an LED pin, and the pinMode() function is used in setup() to read the input at the LED pin. In the loop() function, the LED is set to HIGH and then LOW after a delay of one minute for each.

#define LED_PIN 13  //pin 13 is defined as LED pin

void setup() {
  pinMode(LED_PIN, OUTPUT);  // pinMode function reads input from the LED pin
}

void loop() {
  digitalWrite(LED_PIN, HIGH);   //digitalWrite() will set LED pin to HIGH
  delay(60000);                  // One-minute delay. LED to ON for 1 minute
  digitalWrite(LED_PIN, LOW);    //digitalWrite() will set LED pin to HIGH
  delay(60000);                  //One-minute delay. LED to OFF for 1 minute
}

Hardware Circuit Simulation

Here is the simulation of a hardware circuit in which the above-given code is uploaded to Arduino. The LED pin is initially HIGH for 1 minute; therefore, the LED will glow for one minute. After which, the LED will turn OFF and remain turned OFF for one minute. This happens due to the delay() created in the code.

Conclusion

The Arduino IDE is an open-source platform where users can program according to their requirements. Arduino allows its users to set a delay in the execution or running of a command or function. The method that can be used to delay one minute or more in Arduino is explained in the article.

About the author

Kashif

I am an Electrical Engineer. I love to write about electronics. I am passionate about writing and sharing new ideas related to emerging technologies in the field of electronics.