Removing pot and replacing with press button on led display on LED display.

I am needing help with my program to replace the potentiometer with a button and add a second button that changes the pattern on a LED display.

At the moment the Pot changes the speed of the 24 LEDs via 3 shift registers.

and only run from 1-24.

I want the first button to change how fast it cycles through the shift registers ie first off, second 25%, third 50%, forth 75% and fifth 100%

The second button to change with each press from the 1-24 count to (1,2,3,4), (5,6,7,8) (9,10,11,12) (13,14,15,16)(17,18,19,20,) (21,22,23,24) pattern that moves up and down

Help would be greatly appreciated thank you.

Here is my code that works with the pot, speeding up and slowing down the LEDs

int SER_Pin = 11;   //pin 14 on the 75HC595
int RCLK_Pin = 8;  //pin 12 on the 75HC595
int SRCLK_Pin = 12; //pin 11 on the 75HC595
int sensorValue = 0;

//How many of the shift registers - change this
#define number_of_74hc595s 3

//do not touch
#define numOfRegisterPins number_of_74hc595s * 8

boolean registers[numOfRegisterPins];

void setup(){
  pinMode(SER_Pin, OUTPUT);
  pinMode(RCLK_Pin, OUTPUT);
  pinMode(SRCLK_Pin, OUTPUT);

  //reset all register pins

//set all register pins to LOW
void clearRegisters(){
  for(int i = numOfRegisterPins - 1; i >=  0; i--){
     registers[i] = LOW;

//Set and display registers
//Only call AFTER all values are set how you would like (slow otherwise)
void writeRegisters(){

  digitalWrite(RCLK_Pin, LOW);

  for(int i = numOfRegisterPins - 1; i >=  0; i--){
    digitalWrite(SRCLK_Pin, LOW);

    int val = registers[i];

    digitalWrite(SER_Pin, val);
    digitalWrite(SRCLK_Pin, HIGH);

  digitalWrite(RCLK_Pin, HIGH);


//set an individual pin HIGH or LOW
void setRegisterPin(int index, int value){
  registers[index] = value;

void loop(){
sensorValue = analogRead(0);
  for(int i = 0;i < numOfRegisterPins;i++)
  setRegisterPin(i , HIGH);
  sensorValue = analogRead(0); // reads pin 0
  delay(sensorValue + 5);;
  for(int i = 24; i > 0; i--);


So, which pins are the switches connected to? What mode are the pins in? Where do you read the switch states?

The state change detection example is a starting point. Get the switches wired, and print when they become pressed and when they become released. ONLY after that works properly should you add in code to deal with shift registers and LEDs, AND at that point, it will be reasonably obvious what you need to do.