Hi y'all!
After silently browsing the forum for hours on end and sucking up all the wisdom and experience I could find, here is my first little Arduino project:
The Digital Ship's Bell Clock
This community is amazing and I wish I would have had such a resource when I was working commercially with PICs a few years back. Never got any good at it, but that experience let's me really appreciate all the time and love this community has put into everything.
You rock.
My software runs on a tiny Arduino clone, the Dorkboard:
http://dorkbotpdx.org/wiki/dorkboard
I also made a little carrier to hold all the components and a 5V regulator:
Hidden under the carrier is a little sparkfun DS1307 RealTimeClock module.
A few words regarding the code. I'm multiplexing the 7SEG directly off the ATMega, no shiftregister or dedicated driver. Because of that I refrained from using delay(). I increment certain variables every main loop cycle instead for specific timing on some of the functions.
/**************************************************
File Name: Shipsbells_120910.pde
Date: 12/09/2010
Author: R.Jacobson, with lots of inspiration from the arduino.cc forums
Special thanks to hari; your multiplexing solution for the sparkfun 7-Segment dislpay
is what makes this work!
And to my old friend Mike, for helping me clean up the mess that used to be
void checkBells() !
Hardware: Freeduino Dorkboard, 7-Segment Display, 1307 RTC, Speaker
Description:
This program runs a digital clock showing military (24h)
time and sounds a speaker in the manner of a ship's bell.
A ship's bell is struck every 30 minutes, with number of strikes increasing
by that same cycle, culminating in 8 strikes at the 4th hour.
A day is split into six four-hour shifts:
0000h-0400h-0800h-1200h-1600h-2000h-0000h
Full hours are struck in groups of two for easier recognition.
For example, 1530h (3:30pm) would be (* *) (* *) (* *) (*)
Three double strikes for the full hours and a single for the half hour.
***************************************************/
Unfortunately the entire code was over 9000 characters, too long for the forum (too many explanatory comments? )
You can find the complete code and a circuit diagram here:
http://www.filesavr.com/XABBX5I76AX9URN
Comments, suggestions, improvements, questions, everything is welcome - I'm just glad to be back in the game ! This was a great little practice project. Next one might be a little more sophisticated, but I'm taking one step at a time here :
-R.J.