# maximum delay in arduino an how to make it

I want to make a 1 minute delay on my program? how do I make it? how the maximum delay on the Arduino?

use a long int when giving the delay() function a number.

simple way: Delay(1000) is equal to 1 second, so 60 * 1000 = 1 minute.

you can do this,
for(count = 0; count < 60 ; count++)
{
delay(1000);
}

Or you can look into the blink without delay example, and follow it like a religion.

I was wondering is it possible to write delay(1*60*100) ?

Fightforjuly: I was wondering is it possible to write delay(1*60*100) ?

Yes, but that will only delay for 6000 mS or 6 seconds.

You're looking for

``````delay(1*60*1000UL);
``````

delay(1*60*100)

Even if that worked, why would you do that? You are tieing up the processor from doing anything else while that is going on.

Capture the time with millis(), keep capturing it as part of loop, and note when a minute has gone by.

Arrch:

Fightforjuly: I was wondering is it possible to write delay(1*60*100) ?

Yes, but that will only delay for 6000 mS or 6 seconds.

You're looking for

``````delay(1*60*1000UL);
``````

ok, why there 1000UL? what does it mean?

HazardsMind: Unsigned Long

I was wondering is it possible to write delay(60000UL) ?

yes, but how about a question, what are you trying to do that will require a 1 minute delay?

If you use the delay function, your basically wasting the processors time to do other functions. Look into the link I gave you before about Blink Without Delay. That will give you your 1 minute delay and still allow the processor to do other things in the mean time.

HazardsMind:
yes, but how about a question, what are you trying to do that will require a 1 minute delay?

If you use the delay function, your basically wasting the processors time to do other functions. Look into the link I gave you before about Blink Without Delay. That will give you your 1 minute delay and still allow the processor to do other things in the mean time.

``````/ This is for compatibility with both arduino 1.0 and previous versions
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif

#include <Wire.h>
#include <DS1307.h> // written by  mattt on the Arduino forum and modified by D. Sjunnesson

void setup()
{
Serial.begin(9600);

RTC.stop();
RTC.set(DS1307_SEC,1);        //set the seconds
RTC.set(DS1307_MIN,23);     //set the minutes
RTC.set(DS1307_HR,12);       //set the hours
RTC.set(DS1307_DOW,4);       //set the day of the week
RTC.set(DS1307_DATE,5);       //set the date
RTC.set(DS1307_MTH,3);        //set the month
RTC.set(DS1307_YR,9);         //set the year
RTC.start();

}

void loop()
{

Serial.print(RTC.get(DS1307_HR,true)); //read the hour and also update all the values by pushing in true
Serial.print(":");
Serial.print(":");
Serial.print("      ");                 // some space for a more happy life
Serial.print("/");
Serial.print("/");
Serial.println();

delay(60000UL);

}
``````

I want to create a delay in the RTC for 1 minute ?
when I saw Blink Without Delay article, it use millis function not delay function ? is it?

when I saw Blink Without Delay article, it use millis function not delay function ? is it?

The Millis function runs at startup and does not block the processor from doing other functions. Delay runs when you call it and it will NOT allow you to do anything else until it is done.

So, you have a RTC but you still plan to use the delay function? Why have the RTC at all then? If you want something to happen after a minute has elapsed, then monitor this “RTC.get(DS1307_MIN,false));//read minutes without update (false)” and do something when it changes. Dont add an outside delay.

Im not familar with that RTC library or at least not with RTC.get(DS1307_MIN,false)); But it appears that if it is false, it will not output anything. SO if you want to see the minutes, make it true.

Hello Guys, i'm facing silly problem during setup Nano for sequencer timer. So I 'm using delay() for 5 sec. 3 min. 5 sec. delay and backward, wich is affect starting and counting time, obviously after reading the treat that is unsuitable. What could be the best way to do it? Any Help will appreciate.

I can’t make any sense of what you want to do, but if you are trying to time something without affecting other functions then consider using the millis() function for timing.

See Using millis() for timing. A beginners guide, Several things at the same time and look at the BlinkWithoutDelay example in the IDE.

FilFix: Hello Guys, i'm facing silly problem during setup Nano for sequencer timer. So I 'm using delay() for 5 sec. 3 min. 5 sec. delay and backward, wich is affect starting and counting time, obviously after reading the treat that is unsuitable. What could be the best way to do it? Any Help will appreciate.