int latchPin = 5;
int clockPin = 6;
int dataPin = 4;
byte leds = 0; // Variable to hold the pattern of which LEDs are currently turned on or off
void setup()
{
// Set all the pins of 74HC595 as OUTPUT
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
}
void loop()
{
leds = 0;
updateShiftRegisterR();
delay(100);
for (int i = 0; i < 8; i++){
bitSet(leds, i);
updateShiftRegisterR();
delay(100);
}
leds = 0;
updateShiftRegisterL();
delay(100);
for (int i = 0; i < 8; i++){
bitSet(leds, i);
updateShiftRegisterL();
delay(100);
}
}
}
// https://lastminuteengineers.com/74hc595-shift-register-arduino-tutorial