//Pin connected to ST_CP of 74HC595
int latchPin = PB1;
//Pin connected to SH_CP of 74HC595
int clockPin = PB0;
////Pin connected to DS of 74HC595
int dataPin = PB2;
// delay between each number (in ms)
int delayTime = 1000;
void setup() {
//set pins to output so you can control the shift register and setting button and pot pins to INPUT
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
void loop() {
// for loop to count from 0 to 255
for (int numberToDisplay = 0; numberToDisplay < 255; numberToDisplay++) {
// set the latch pin to low so LEDs dont change during shift
digitalWrite(latchPin, LOW);
// shift out the bits:
shiftOut(dataPin, clockPin, MSBFIRST, numberToDisplay);
//take the latch pin high so the LEDs will light up:
digitalWrite(latchPin, HIGH);
//print the number to serial
// pause before next value
delay(delayTime);
}
// Announcement that count has finished and is now restarting
}