Go Down

Topic: Turning lamps off 12:00 - 01:00 PM (Read 2715 times) previous topic - next topic


Hi everybody,

I want to turn the lamps off such as between 12-1 pm or 5-6 pm with relay.
I have relaies, Arduino Ethernet (software v1.0.2) and basic knowledge about using arduino, but i have problems with software.

I tried to use that i read discussions about the "datetime" libraries.Although I solve a few problem like "BYTE",i couldn't do anything finally.

Would you mind if you let me know how can I do these project easily.Is there any way to do without using libraries and except timer(delay etc).Any simple way like Visual Basic or Pascal to got it a few code.

It is not important working with perfect timing.  Moreover, maybe it could be work with stability only feeding with adaptory etc.

Please help me immediately,I am in a hurry

Thanks for your interest


My first though would be to look at the NTP examples. Send out for the time every say 10 seconds or so, and parse the hour out of it.


Not using a library will make your job much, much harder.  Included with the Time library is another library, TimeAlarms that does exactly what you need.  There is an example in the library zip file you download that shows specifically how to set up an alarm and how to deal with it.  Using time and timealarm will make your task quite simple and you won't have to use delay or anything like it.


Just click on the download link and look through the examples in the download.



Thanks a lot all,

I fixed it using TimeAlarm is perfect idea. $) And also, for other person that have similar problems,while using TimeAlarm example,i have one more problem which says:

C:\arduino-1.0\libraries\TimeAlarm\TimeAlarm.cpp:268: error: 'millis' was not declared in this scope

And than,I solve it with these;


Link says that find these adress Documents/Arduino/Libraries/TimeAlarm/TimeAlarm.cpp
and open it and change the #include < WProgram.h > line to #include < Arduino.h >

That's all.

You can also use these unit;


it provides you real timing.Moreover,you turn the arduinos power off,unless you think if the setting time will be gone.With other words,you shouldn't set the arduino's time,like in the example every upload bacause of the fact that it has a simple timer logic,you set the time and date,though.

Thanks again for your interest,

See you in next project,questions or solutions.

Go Up