Hello, I have Veiled Chameleons, and I want relay do be HIGH for 12 hours, and then LOW for 12 hours..
i won't be home for one week, so can you tell me how much reliable is my Arduino Uno? I dont want it to turn off or so... Can I use delay function? Please without RTC, because I dont have any working(DS1302 is very unaccurate).. Or can I use millis function? How to use it(I'm new to programming)? If you have any ideas, please write code down and explain it to me(I want to learn it :))..
If you think a DS1302 is inaccurate, try using the Uno's ceramic resonator with its +/- 5000ppm basic
accuracy!
Three approaches - time from internet, or realtime clock, or ensure you have an accurate quartz crystal
system clock on your Arduino (they used to be all quartz, but they stopped that alas).
Rather than call delay(), use the technique in BlinkWithoutDelay example.
, so can you tell me how much reliable is my Arduino Uno?
It's very reliable... just as reliable as any other electronic gadget... as long as your code is bug-free...
I dont want it to turn off or so... Can I use delay function?
Yes, but since "nothing happens" during the delay time you won't know if it's working unless you wait 12 hours. You might want to blink and LED or something. In that case use millis()
DS1302 is very unaccurate)..[/quite]No clock is perfect, but I assume the DS1302 is more accurate than the Arduino's clock.
Or can I use millis function? How to use it(I'm new to programming)? If you have any ideas, please write code down and explain it to me(I want to learn it :))..
Just modify the [u]Blink Without Delay Example[/u] for a much-much longer delay. Please double-check my math, but I get 12 hours = 43,200 seconds = 43,200,000 milliseconds.
If you want to do blink an LED at the same time, you'll need two timers (two different interval variables and two different previous variables). Look at the post at the top of the forum that says "Demonstration code for several things at the same time."
I would recommend an electronic timer, the kind used to turn things on and off at user selected times. Many have an internal battery to maintain time and programming during power interruptions. I have several that I use to turn a couple lamps on and off throughout the evening to make my second home look occupied while I am away. Each timer can perform up 24 events every day and can even add a random delay to each event so that the lamps never come on at precisely the same time each day.