/*
74HC595 Arduino Shift Register example for Wokwi
Copyright (C) 2021, Uri Shaked
License: MIT.
*/
const int dataPin = 2; /* DS */
const int clockPin = 3; /* SHCP */
const int latchPin = 4; /* STCP */
void setup() {
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(latchPin, OUTPUT);
}
int pattern = 0b00001111;
void loop() {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, pattern);
digitalWrite(latchPin, HIGH);
delay(500);
//pattern = ~pattern; // Invert the pattern
pattern = ~pattern;
}