/*
NLSF595 Arduino Shift Register example for Wokwi
Copyright (C) 2021, Uri Shaked
License: MIT.
*/
const int dataPin = 2; /* SI */
const int clockPin = 3; /* SCK */
const int latchPin = 4; /* RCK */
void setup() {
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(latchPin, OUTPUT);
}
void sendData(uint8_t pattern) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, pattern);
digitalWrite(latchPin, HIGH);
}
void loop() {
// Red
sendData(0b11011011);
delay(500);
// Green
sendData(0b10110111);
delay(500);
// Purple
sendData(0b01001011);
delay(500);
}