/*
Use 74hc595 SIPO to extend Output pins
By defult, only the left-most and right-most
LEDs are ON since they are connected to VCC
*/
#define SRCP 21 // shift register clock
#define STCP 22 // latch clock
#define DS 23 // serial data out
void setup()
{
pinMode(SRCP, OUTPUT);
pinMode(STCP, OUTPUT);
pinMode(DS, OUTPUT);
}
void loop()
{
for(int i=0; i<9; i++){
int N=pow(2,i)-1; //0,1,3,7..
digitalWrite(STCP,LOW); //disconnect
shiftOut(DS,SRCP,LSBFIRST,N);
digitalWrite(STCP,HIGH); //connect
delay(500);
}
}