Arrays, matrices, and clocks, oh my!

Hey all, I was wondering if I could get some help with a project I'm working on - I'm fairly new to Arduino, and as such I've become sort of stalled. My idea is this: A 3x5 LED matrix wich acts as a wall clock - column 1 displays hours, column 2 displays tens, and column 3 displays ones.

() ( ) () 5 the concept is simple enough; minutes/hours add up from ( ) ( ) () 4 the bottom of the display, and their values are added ( ) () ( ) 3 together a-la a binary clock. For example, the diagram on (*) ( ) ( ) 2 the left would read "7:39" [(5+2)h + 3t + (5+4)m]. As w/ ( ) ( ) ( ) 1 any LED matrix, I need a way to strobe/scan the columns h t o continuously while displaying the time data for each one (as appropriate); I think I've figured this out using a for loop. What I can't wrap my head around is a reasonable/easy way to display the time data for each column as it's scanned...I'd thought about using arrays, but I'm just not sure how to proceed. I hope I've made my idea at least sort of comprehensible - any help is appreciated. P.S.: I'm trying to avoid any RTCs, LED drivers, or other "outboard" parts as much as possible, but if it can't be done then I'll suck it up.



//v1.0.0 - 23 July 2010

int ary_y[5] =          // 5 pin Y array [display array]
    {2, 3, 4, 5, 6}
int ary_x[3] =          // 3 pin X array [scanning array]
    {8, 9, 10};
//--set 12:00:00 at startup--
  int hval = 12, tval, mval, secs = 0;

void setup(){
//--array strobe initialize--
  int strobe = 1
    for (scan = 0; strobe > 2; strobe++)
//--button pins initialize--
   pinMode(12,INPUT); pinMode(13,INPUT);

void loop(){
//--static second count from startup--
  static unsigned long clk = 0;
  if (millis() - clk >= 1000){
    clk = millis();
  if (secs > 59){
     secs = 0;}
  if (mval > 9){
     mval = 0;}
  if (tval > 5){
     tval = 0;}
  if (hval > 12){hval = 0};
//--matrix X scan--
void scanning(){
  for (strobe = 1; strobe > 2; strobe++){        // loop X scan [8,9,10]
      digitalWrite(ary_x[scan], HIGH)
      digitalWrite(ary_x[scan - 1], LOW)
      if (scan > 3) {scan = 1}

I am not the most experienced with Arduinos/circuits/programming, but this is how I would tackle the project. First I would decide whether or not the project seems possible. From what I read, I see nothing that should prevent this idea from working. The only issue may be the inaccuracy of an Arduino keeping time. Without the use of a real time clock, your Arduino may drift off several seconds a day. Next step is to build it. It is not clear to me whether you built or wired up the project yet. If you have not, I'd say get it constructed because there are no foreseeable obstacles that would force you to abandon the idea. Once constructed, I wouldn't worry about time keeping until I knew I could control the LEDs as desired. Start with a 2D byte array to store the states of LEDS. Value of 0 = off, 1 = on. Initialize the array with some pattern and write a function that when called flashed those LEDs once. Call it in a loop and make sure the pattern you wanted to be displayed is displayed properly. Next write a function that takes hours and minute values and modifies the 2D array in a way the represents the time you want to show. Test it by calling it once with test values and then calling the display function repeatedly. Only once that works, would I bother with keeping time.

My final routine would look something like this:

byte ledPattern[5][3];
long nextTimeUpdate = millis() + 1000;
int hours = 12;
int minutes = 00;
int seconds = 00;

      if (nextTimeUpdate >= millis()) //if a second has passed
            updateTime(); //adjusts hours and minutes and seconds to current time
            timeToPattern(); //set array pattern to represent current time
            //Schedule next time update for one second
            nextTimeUpdate += 1000; 


I hope this helps. Again, I am not very experienced either so I hope I am not leading you in a wrong direction.