#include uint8_t PINS[6] = {7,6,5,4,3,2}; // array of the LED connections, cathode[0] andode[1] uint8_t LEDS[24][2] = { {6,1}, // seconds LED {2,1}, {1,2}, {3,1}, {1,3}, // 5-hour {4,1}, {1,4}, {5,1}, {1,5}, // 1-hour {4,3}, {3,4}, {3,2}, {2,3}, {4,2}, {2,4}, {5,2}, {2,5}, {6,2}, {2,6}, {1,6}, // 5-minute {5,3}, {3,5}, {6,3}, {3,6} // 1-minute }; uint8_t framebuffer[24]; void setup() { for (uint8_t i = 0; i < 24; i++) { framebuffer[i] = 0; } } void loop() { static uint8_t i=0; uint8_t anode, cathode; cathode = PINS[ LEDS[i][0] -1 ]; anode = PINS[ LEDS[i][1] -1 ]; // switch off voltages digitalWrite(cathode, LOW); digitalWrite(anode, LOW); // switch to input pinMode(cathode, INPUT); pinMode(anode, INPUT); // next LED i++; i %= 24; //modulo 24 cathode = PINS[ LEDS[i][0] -1 ]; anode = PINS[ LEDS[i][1] -1 ]; // switch to outputs pinMode(cathode, OUTPUT); pinMode(anode, OUTPUT); // switch voltages digitalWrite(cathode, LOW); digitalWrite(anode, HIGH); delay(0.4); }