# timing

Dear all, kindly need help with delay order and timing in general. at the examples " blink" If we wanted a delay of 1 second we type it 1000 if for 3 seconds we type 3000 but what if I wanted the delay to be for 1 minute , does it mean it will be 60000 or an hour to be 3600000000 or what ? Kindly advise as I need to make the timing for a specific order to be 7 minutes and 1 hour

The arithmetic is simple but make sure you do arithmetic as unsigned longs, not ints.

Im sorry not getting it Could You explain?

The parameter for the delay() function is a number of milliseconds as should be obvious from the 1 second and 3 seconds examples that you quote.

So, a 1 minute delay would be 60 * 1000 (60000) and an hour 60 * 60 * 1000 (3600000)

I will leave the discussion as to whether using delay() like this is a good idea for later in the thread ...

If you use variables as the parameters make sure that they can hold big enough values

One hour, seven minutes.

``````unsigned long oneMinute = 1000UL * 60UL;
unsigned long pauseTime = (oneMinute * 60UL) + (oneMinute * 7UL);
``````

Keep in mind that delay(milliseconds) generally means the uC is sitting there doing nothing else while waiting. A better approach is to capture the starting "time" using millis(), then every pass thru loop() capture the again and see if your limit has been reached, then the uC can do other things while waiting. That's the theory behind "blink without delay".