2 Shift register with 16 LEDs

Hai, anyone know how to clear or reset of the shift register ? I am displaying the 16 LEDs. when i switch to off state i need all 16 LEDs to be off.

example : if(switch1==HIGH){ //some code for my LED to display pattern1 } else if (switch2==HIGH){ //some code for my LED to display pattern2 } else //CLEAR or RESET all the 16bits (OFF the LED)

Instead of sending out your pattern(1001010010...), send out all zeros.

Shift out 16 zeroes perhaps ?

Depending on your output coding you could also just send 1 single 0 as value since converted to a 16 bit binary it gives you again 16 0's

The following would set all outputs to 0.

outputVar = 0; 

digitalWrite(latchPinOut, LOW);                 
                                                 
  shiftOut(dataPinOut, clockPinOut, MSBFIRST, (outputVar >> 8));
                                                               
  shiftOut(dataPinOut, clockPinOut, MSBFIRST, outputVar);    
                                                       
  digitalWrite(latchPinOut, HIGH);