/*
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);
digitalWrite(latchPin, LOW);
int pattern = 0b00110000;
shiftOut(dataPin, clockPin, LSBFIRST, pattern);
pattern=0b10101010;
shiftOut(dataPin, clockPin, LSBFIRST, pattern);
pattern=0b01010101;
shiftOut(dataPin, clockPin, LSBFIRST, pattern);
pattern=0b11001100;
shiftOut(dataPin, clockPin, LSBFIRST, pattern);
pattern=0b00110011;
shiftOut(dataPin, clockPin, LSBFIRST, pattern);
pattern=0b00110011;
shiftOut(dataPin, clockPin, LSBFIRST, pattern);
shiftOut(dataPin, clockPin, LSBFIRST, pattern);
digitalWrite(latchPin, HIGH);
}
void loop() {
delay(10);
}