//example sketch to use created shift register functions int serialIn = 34; int registerClk = 36; int serialClk = 38; int serialClr = 40; void setup(){ //setting the mode of the pins pinMode(serialIn, OUTPUT); pinMode(registerClk, OUTPUT); pinMode(serialClk, OUTPUT); pinMode(serialClr, OUTPUT); //setting the initial pin values digitalWrite(serialIn, LOW); digitalWrite(registerClk, LOW); digitalWrite(serialClk, LOW); digitalWrite(serialClr, LOW); //clearing out the registers digitalWrite(registerClk, HIGH); digitalWrite(registerClk, LOW); digitalWrite(serialClr, HIGH); }//end of setup void loop(){ lightUpOneLed(1,250); lightUpOneLed(2,250); lightUpOneLed(3,250); lightUpOneLed(4,250); lightUpOneLed(5,250); lightUpOneLed(6,250); lightUpOneLed(7,250); lightUpOneLed(8,250); }//end of loop //declaring global variables for the function int offLed=0; int onLed=0; void lightUpOneLed(int ledNumber, int lightDuration){ //turning on the specific anode digitalWrite(registerClk, LOW); for(offLed=0; offLed<(ledNumber-1); offLed++){ digitalWrite(serialIn, LOW); digitalWrite(serialClk, HIGH); digitalWrite(serialClk, LOW); } for(onLed=0; onLed<1; onLed++){ digitalWrite(serialIn, HIGH); digitalWrite(serialClk, HIGH); digitalWrite(serialClk, LOW); } for(offLed=0; offLed<(8-ledNumber); offLed++){ digitalWrite(serialIn, LOW); digitalWrite(serialClk, HIGH); digitalWrite(serialClk, LOW); } digitalWrite(registerClk, HIGH); delay(lightDuration); }//end of lightUpOneLed function