Time Calculations

How would you write a routine in the Arduino and set an event variable when a sensor detects an event that occurs from Midnight to 6:00am?

I'm lost.



Take a look at real time clock module.

I'm lost.

You need a GPS - that'll also help with the RTC requirement XD

I'm lost.

DO you have code you tried so far, please post it so we can provide help and explain why it didn't work.

The Arduino does not have a clock in it. It has a timer that starts counting when power is applied and the Arduino libraries have initialised. So time is all relative.

If you want to do things at a specific tie of day (ie, by a clock) , then you should get a Real Time Clock (RTC) module that has a battery backed clock. You can read the time from this and do whatever you want in softeare. When the poser is turned off the battery backup keeps the clock running, so the time does not reset.

A commopn clock module has a clock chip called the DS1307 (use this for search, cheaply available in many places eg eBay) and I have a library at my repository (see below in the signature) to use this chip.

Good Luck!