Go Down

Topic: Simple clock (Read 970 times) previous topic - next topic

stoopkid

I want to eventually make a clock of some sort. Right now I simply want to understand how to keep time(I know that it would need to be set at startup but right now I'm not even worried about that). The examples in the Time Library all return errors for me like "'time_t' does not name a type" among many others. I was hoping for some help on this or an example of the most very basic way to keep accurate time on the arduino uno.

thanks

PaulS

Quote
I was hoping for some help on this or an example of the most very basic way to keep accurate time on the arduino uno.

The most accurate way to keep time is to use an external RTC (real time clock). They are pretty cheap, and more accurate than the crystal or resonator on the Arduino.

If you need help with a sketch, you need to be a bit more specific about which sketch is giving you trouble. Post the code, or a link to it.

stoopkid

Well, all I really am looking for is the most basic, form of time keeping that can be programmed.

CrossRoads

How about a simple count up software timer then that runs off of millis() or micros()?
Two buttons that you push/debounce to set the time, then free runs after that?
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

psppb

Try using the DS1307 Chip.

It might be easier

liudr

You can need a real time clock. All you have to do is to first call a bunch of functions, like RTC.settime(), to set up the clock, then anytime you want the time, you do something like RTC.gettime(). I don't think it's that difficult.

I have some sample codes:
http://liudr.wordpress.com/2010/11/25/arduino-alarm-clock-with-phi-1-shield/

frank26080115

Freelance engineer, consultant, contractor. Graduated from UW in 2013.

stoopkid

Thanks guys, Ill look into RTC's.

Go Up