#define SHCP 2 // Clock
#define STCP 3 // Storage Register Clock Input (latch)
#define DS 4 // Serial Input (Data)
void setup() {
pinMode(SHCP, OUTPUT);
pinMode(STCP, OUTPUT);
pinMode(DS, OUTPUT);
}
void loop() {
for (int n = 0; n < 256; n++) {
digitalWrite(STCP, LOW); // hold the value.
shiftOut(DS, SHCP, MSBFIRST, n);
digitalWrite(STCP, HIGH); // flush the value to the outputs.
delay(500);
}
}