5 min of delay

hi all, i new one with Arduin o, i want to execute the function after a 5min delay. so how to make 5 min delay. thanks like. if(sensor == 0) { while(1) { gps(); delay(2000) getltlg(); delay(1000); tracking(); delay(1000); delay of 5 min; } }

Look at the included example in the IDE called Digital --> Blink Without Delay

what do you think delay(1000); does ?

it provides 1 sec delay

ykn: it provides 1 sec delay

Using delay() is blocking code.

ieee488: Using delay() is blocking code.

of course - but he does not need anything else apparently (although once he tested his sensor there is no way to exit his while)

ykn: it provides 1 sec delay

so if you wanted 5 minutes?

J-M-L: of course - but he does not need anything else apparently

That's what he thinks now. :-) There is always something else. These newbies have grand plans.

ykn:
hi all,
i new one with Arduin o, i want to execute the function after a 5min delay.
so how to make 5 min delay.
thanks
like.
if(sensor == 0)
{
while(1)
{
gps();
delay(2000)
getltlg();
delay(1000);
tracking();
delay(1000);
delay of 5 min;
}
}

Hi ykn,

Welcome…

Please use the code tag when posting codes.

delay ( 1000 ); //<----- This is a second delay…

what if ???

delay ( 1000 * 5UL ); // <---- Would this provide a 5 second worth of delay?

Anyway looking forward… Please limit the use of delay in your code… Thank you

ieee488: That's what he thinks now. :-) There is always something else. These newbies have grand plans.

everyone needs a grand plan !! ;D :grin: :sunglasses:

(you are conceptually right for a solid approach of course)

Ashraf_Zolkopli:
Hi ykn,

Welcome…

Please use the code tag when posting codes.

delay ( 1000 ); //<----- This is a second delay…

what if ???

delay ( 1000 * 5UL ); // <---- Would this provide a 5 second worth of delay?

Anyway looking forward… Please limit the use of delay in your code… Thank you
[ sir i need 5 min delay]

How many milliseconds there are in 5 minutes?

i want to write a code for GPS location that send the Latitude and longitude after each 5 min , when the button is pressed. i am confused how to make 5 min delay. please suggest me

delay(1000*60*5); is it work??

Yes Sir! Or you can do the calculation yourself. 5 minutes is 300 seconds. delay(300000);

If you want something crazy like 24 hours delay, you can use delay(86400000);

If you want something crazy like 24 hours delay, you can use delay(86400000);

Testing that will, of course, take a while ...

ykn:
delay(1000605);
is it work??

almost you need to tell the compiler that this needs to be done using unsigned long numbers or the pre-processor will mess up and do that with integers → add ul after one of the number and then the pre-processor will understand this needs to be done using unsigned long format

delay(1000[color=red]ul[/color]*60*5);

ykn: i want to write a code for GPS location that send the Latitude and longitude after each 5 min , when the button is pressed.

makes for a long button press...

thanks for your valuable response

as mentioned above the way your code is today, once you press the button you never exit your while(1) loop - is that really what you want?