Pages: [1]   Go Down
Author Topic: Simple clock  (Read 767 times)
0 Members and 1 Guest are viewing this topic.
California
Offline Offline
Sr. Member
****
Karma: 2
Posts: 433
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 46063
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

California
Offline Offline
Sr. Member
****
Karma: 2
Posts: 433
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 438
Posts: 23725
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

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.

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 85
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try using the DS1307 Chip.

It might be easier
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6893
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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/
Logged


0
Offline Offline
God Member
*****
Karma: 0
Posts: 594
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Check out this Instructable
http://www.instructables.com/id/Music-Playing-Alarm-Clock/

Logged

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

California
Offline Offline
Sr. Member
****
Karma: 2
Posts: 433
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks guys, Ill look into RTC's.
Logged

Pages: [1]   Go Up
Jump to: