Function to make arduino sample a sensor every 20 min

What's the best way to make the arduino read an analog input pin every 20 minutes ? should I just use the delay() function?

There is a timer library somewhere.I have test it one time to read a sensor every 5 minutes.There is also another solution using a RTC(real time clock) connected on the arduino to use time with more accuracy.

Or, there is the "Blink Without Delay" example to look at. Instead of turning an LED on or off, you would be reading a sensor.

Do you need to do anything else between sensor reads?

I only need to write the values to the EEPROM memory.

mahela007:
I only need to write the values to the EEPROM memory.

Well, in general EEPROM is not meant as a store for realtime data.
But it's your Arduino, you can do anything with it.
You can store some values there, and store which value you have written recently (!)
That's easier than a DataLogger/RTC shield, using an external memory card, just for storing 72 bytes/day.

However, you forgot a task: You may want to read the EEPROM at some time. So better go for the "Blink without delay" example, PaulS proposed.

Loading a different sketch just to read the EEPROM is too poor :wink:
( But it's your Arduino, you can do anything with it. )

BTW: Any solution, with or without delay, will start at reset/power up.
So you do not mind to not have the EEPROM events sychronized with anything ?