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.
Regards,
John/me
//SHOJI CLOCK - J. RIGGLES
//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++)
{pinMode(ary_x[strobe],OUTPUT);}
//--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();
secs++;
//--ones--
if (secs > 59){
mval++;
secs = 0;}
//--tens--
if (mval > 9){
tval++;
mval = 0;}
//--hour--
if (tval > 5){
hval++;
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)
delay(10);
digitalWrite(ary_x[scan - 1], LOW)
if (scan > 3) {scan = 1}
}