// https://forum.arduino.cc/t/making-a-clock-clock/1320259/
// https://wokwi.com/projects/345206751024382546
const byte digit[][3] = [{2, 3}, { 4, 5}, {6, 7}]; // data pins for four digits
const byte stepdir[][3] = [{0, 2, 4}, {1, 3, 5}]; // column of three clocks
const byte dclPin[][3] = [{x, y, z}, {x, y, z}, {x, y, z}]; // data, clock, latch
void setup() {
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(latchPin, OUTPUT);
}
void loop() {
}
void setRegisterPin(int index, int value) {
// Set an individual pin HIGH or LOW
registers[index] = value;
}
void writeRegisters() {
// Set and display registers
digitalWrite(LATCH_PIN, LOW);
for (int i = numOfRegisterPins - 1; i >= 0; i--) {
digitalWrite(CLOCK_PIN, LOW);
digitalWrite(DATA_PIN, registers[i]);
digitalWrite(CLOCK_PIN, HIGH);
}
digitalWrite(LATCH_PIN, HIGH);
}
int pattern = 0b10101010;
void showPattern() {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, pattern);
digitalWrite(latchPin, HIGH);
delay(500);
pattern = ~pattern; // Invert the pattern
}