Help implementing time library to LED analogue clock

Hi,

I have created an LED clock that consists of 2x60 LED rings (Seconds and Minutes) and 1x12 LED rings (Hours) I currently have code running it that simply turns on and off the LED’s in order, code at bottom. The LED’s are wired together in what I would describe as 2 of 5x12 matrix and 1x12. The led’s 0-4, 5-9, 10-14 etc are common Anode and 0 & 5 & 10 etc are common Cathode. I would like to improve it by implementing the time library but I’m not sure exactly how to do this. If someone could please point in the right direction.

Some code has been cut out but you should get the idea.

And before you tell me that using a RTC & MAX7219 chip it would make things much easier, I know this and will be going on to make a clock using these when I finally get the parts and just wanted to see if I could make it with what I had.

Scrumpy

``````int LEDPin[] = {15, 14, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 38, 36, 34, 32, 30, 28, 26, 24, 22, 19, 18, 17, 16};
int PlanePin[] = {A5, A4, A3, A2, A1, A10, A9, A8, A7, A6, A11};
int HourPin[] = {40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52};
int timer = 1001.5;

// initialization
void setup()
{

int pin; // loop counter
// set up LED pins as output (active HIGH)
for (pin=0; pin <= 25; pin++) {
pinMode( LEDPin[pin], OUTPUT );
}
// set up plane pins as outputs (active LOW)
for (pin=0; pin <= 11; pin++) {
pinMode( PlanePin[pin], OUTPUT );
}
for (pin=0; pin <= 12; pin++) {
pinMode( HourPin[pin], OUTPUT );
}
}

void loop()
{
digitalWrite(PlanePin[10], HIGH);
digitalWrite(HourPin[5], HIGH);
digitalWrite(HourPin[6], LOW);
digitalWrite(HourPin[7], HIGH);
digitalWrite(HourPin[8], HIGH);
digitalWrite(HourPin[9], HIGH);
digitalWrite(HourPin[10], HIGH);
digitalWrite(HourPin[11], HIGH);
digitalWrite(HourPin[0], HIGH);
digitalWrite(HourPin[1], HIGH);
digitalWrite(HourPin[2], HIGH);
digitalWrite(HourPin[3], HIGH);
digitalWrite(HourPin[4], HIGH);
Hour();
digitalWrite(HourPin[6], HIGH);
digitalWrite(HourPin[7], LOW);
Hour();
digitalWrite(HourPin[7], HIGH);
digitalWrite(HourPin[8], LOW);
Hour();
digitalWrite(HourPin[8], HIGH);
digitalWrite(HourPin[9], LOW);
Hour();
digitalWrite(HourPin[9], HIGH);
digitalWrite(HourPin[10], LOW);
Hour();
digitalWrite(HourPin[10], HIGH);
digitalWrite(HourPin[11], LOW);
Hour();
digitalWrite(HourPin[11], HIGH);
digitalWrite(HourPin[0], LOW);
Hour();
digitalWrite(HourPin[0], HIGH);
digitalWrite(HourPin[1], LOW);
Hour();
digitalWrite(HourPin[1], HIGH);
digitalWrite(HourPin[2], LOW);
Hour();
digitalWrite(HourPin[2], HIGH);
digitalWrite(HourPin[3], LOW);
Hour();
digitalWrite(HourPin[3], HIGH);
digitalWrite(HourPin[4], LOW);
Hour();
digitalWrite(HourPin[4], HIGH);
digitalWrite(HourPin[5], LOW);
Hour();
}

void Hour() //one loop of minutes ring
{
digitalWrite(LEDPin[23], LOW);
digitalWrite(LEDPin[12], HIGH);
digitalWrite(PlanePin[5], LOW);
digitalWrite(PlanePin[6], HIGH);
digitalWrite(PlanePin[7], HIGH);
digitalWrite(PlanePin[8], HIGH);
digitalWrite(PlanePin[9], HIGH);
Second();
digitalWrite(PlanePin[5], HIGH);
digitalWrite(PlanePin[6], LOW);
Second();
digitalWrite(PlanePin[6], HIGH);
digitalWrite(PlanePin[7], LOW);
Second();
digitalWrite(PlanePin[7], HIGH);
digitalWrite(PlanePin[8], LOW);
Second();
digitalWrite(PlanePin[8], HIGH);
digitalWrite(PlanePin[9], LOW);
Second();
digitalWrite(LEDPin[12], LOW);
digitalWrite(LEDPin[13], HIGH);
digitalWrite(PlanePin[5], LOW);
digitalWrite(PlanePin[6], HIGH);
digitalWrite(PlanePin[7], HIGH);
digitalWrite(PlanePin[8], HIGH);
digitalWrite(PlanePin[9], HIGH);
Second();
digitalWrite(PlanePin[5], HIGH);
digitalWrite(PlanePin[6], LOW);
Second();
digitalWrite(PlanePin[6], HIGH);
digitalWrite(PlanePin[7], LOW);
Second();
digitalWrite(PlanePin[7], HIGH);
digitalWrite(PlanePin[8], LOW);
Second();
digitalWrite(PlanePin[8], HIGH);
digitalWrite(PlanePin[9], LOW);
Second();
digitalWrite(LEDPin[13], LOW);
digitalWrite(LEDPin[14], HIGH);
digitalWrite(PlanePin[5], LOW);
digitalWrite(PlanePin[6], HIGH);
digitalWrite(PlanePin[7], HIGH);
digitalWrite(PlanePin[8], HIGH);
digitalWrite(PlanePin[9], HIGH);

void Second() //one loop of seconds ring
{
digitalWrite(LEDPin[11], LOW);
digitalWrite(LEDPin[0], HIGH);
Seconds();
digitalWrite(LEDPin[0], LOW);
digitalWrite(LEDPin[1], HIGH);
Seconds();
digitalWrite(LEDPin[1], LOW);
digitalWrite(LEDPin[2], HIGH);
Seconds();
digitalWrite(LEDPin[2], LOW);
digitalWrite(LEDPin[3], HIGH);
Seconds();
digitalWrite(LEDPin[3], LOW);
digitalWrite(LEDPin[4], HIGH);
Seconds();
digitalWrite(LEDPin[4], LOW);
digitalWrite(LEDPin[5], HIGH);
Seconds();
digitalWrite(LEDPin[5], LOW);
digitalWrite(LEDPin[6], HIGH);
Seconds();
digitalWrite(LEDPin[6], LOW);
digitalWrite(LEDPin[7], HIGH);
Seconds();
digitalWrite(LEDPin[7], LOW);
digitalWrite(LEDPin[8], HIGH);
Seconds();
digitalWrite(LEDPin[8], LOW);
digitalWrite(LEDPin[9], HIGH);
Seconds();
digitalWrite(LEDPin[9], LOW);
digitalWrite(LEDPin[10], HIGH);
Seconds();
digitalWrite(LEDPin[10], LOW);
digitalWrite(LEDPin[11], HIGH);
Seconds();
}

void Seconds() //turns on sequentual leds in seconds ring
{
digitalWrite(PlanePin[0], LOW);
digitalWrite(PlanePin[1], HIGH);
digitalWrite(PlanePin[2], HIGH);
digitalWrite(PlanePin[3], HIGH);
digitalWrite(PlanePin[4], HIGH);
delay(timer);
digitalWrite(PlanePin[0], HIGH);
digitalWrite(PlanePin[1], LOW);
delay(timer);
digitalWrite(PlanePin[1], HIGH);
digitalWrite(PlanePin[2], LOW);
delay(timer);
digitalWrite(PlanePin[2], HIGH);
digitalWrite(PlanePin[3], LOW);
delay(timer);
digitalWrite(PlanePin[3], HIGH);
digitalWrite(PlanePin[4], LOW);
delay(timer);
}
``````
``````int pin; // loop counter
// set up LED pins as output (active HIGH)
for (pin=0; pin <= 25; pin++) {
pinMode( LEDPin[pin], OUTPUT );
}
``````

I only got this far. pin is an index, not a pin number. If you can’t use reasonable names for variables, I can’t bother reading any farther.