Help with multii button light strip please

I am having trouble with this code.

The errors I am getting are:

‘startShow’ was not declared in this scope

startShow(showType);

^

error: a function-definition is not allowed here before ‘{’ token

void startShow(int i) {

^

error: expected ‘}’ at end of input

}

^

exit status 1
‘startShow’ was not declared in this scope

// This is a demonstration on how to use an input device to trigger changes on your neo pixels.
// You should wire a momentary push button to connect from ground to a digital IO pin.  When you
// press the button it will change to a new pixel animation.  Note that you need to press the
// button once to start the first animation!

#include <Adafruit_NeoPixel.h>

#define BUTTON1_PIN   5    // Digital IO pins connected to the buttons.  These will be
#define BUTTON2_PIN   6    // driven with the internal pull-up resistor so the switch should
#define BUTTON3_PIN   7    // pull the pin to ground momentarily.  On a high -> low
#define BUTTON4_PIN   8    // transition the button press logic will execute.
#define BUTTON5_PIN   9    // Digital IO pin connected to the button.  This will be
                          // driven with a pull-up resistor so the switch should
                          // pull the pin to ground momentarily.  On a high -> low
                          // transition the button press logic will execute.

#define PIXEL_PIN    2    // Digital IO pin connected to the NeoPixels.

#define PIXEL_COUNT 60

// Parameter 1 = number of pixels in strip,  neopixel stick has 8
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_RGB     Pixels are wired for RGB bitstream
//   NEO_GRB     Pixels are wired for GRB bitstream, correct for neopixel stick
//   NEO_KHZ400  400 KHz bitstream (e.g. FLORA pixels)
//   NEO_KHZ800  800 KHz bitstream (e.g. High Density LED strip), correct for neopixel stick
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);

bool oldState = HIGH;
int showType = 0;

bool buttonAction1 = HIGH;
bool buttonAction2 = HIGH;
bool buttonAction3 = HIGH;
bool buttonAction4 = HIGH;
bool buttonAction5 = HIGH;


void setup() {
  
  pinMode(BUTTON1_PIN, INPUT_PULLUP);
  pinMode(BUTTON2_PIN, INPUT_PULLUP);
  pinMode(BUTTON3_PIN, INPUT_PULLUP);
  pinMode(BUTTON4_PIN, INPUT_PULLUP);
  pinMode(BUTTON5_PIN, INPUT_PULLUP);
  
  
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}


 void loop ()   {

   if (digitalRead(BUTTON1_PIN) == LOW) {        //Button one is pressed!
      

	// Get current button state.
 	 bool newState = digitalRead(BUTTON1_PIN);

 	 // Check if state changed from high to low (button press).
 	 if (newState == LOW && oldState == HIGH) {
 	   // Short delay to debounce button.
   	 delay(20);
  	  // Check if button is still low after debounce.
  	  newState = digitalRead(BUTTON1_PIN);
  	  if (newState == LOW) {
  	    showType++;
  	    if (showType > 9)
   	     showType=0;
  	    startShow(showType);
  	  }
 	 }

 	 // Set the last button state to the old state.
 	 oldState = newState;
	}

	void startShow(int i) {
  switch(i){
 	case 0: colorWipe(strip.Color(0, 0, 0), 50);    // Black/off
             break;
   	case 1: colorWipe(strip.Color(255, 15, 15), 50);  // Pinkish
   	         break;
   	case 2: colorWipe(strip.Color(0, 255, 0), 10);  // Green
   	         break;
   	case 3: colorWipe(strip.Color(0, 0, 255), 50);  // Blue
   	         break;
   	case 4: theaterChase(strip.Color(127, 127, 127), 50); // White
   	         break;
  	case 5: theaterChase(strip.Color(127,   0,   0), 50); // Red
  	         break;
 	case 6: theaterChase(strip.Color(  0,   0, 127), 50); // Blue
 	         break;
    case 7: colorWipe(strip.Color(70, 40, 25), 50);  // Bgsdlue);
            break;
    case 8: colorWipe(strip.Color(100, 0, 55), 50);  // Bsblue;
            break;
    case 9: colorWipe(strip.Color(20, 166, 155), 50);  // Bbdlue(50);
            break;
  }
}
            
 }

    else if (digitalRead(BUTTON2_PIN) == LOW) {
      //Button 2 is pressed!
     colorWipe(strip.Color(150, 255, 0), 50);  // 36Green
           
 }
   else if (digitalRead(BUTTON3_PIN) == LOW) {
      //Button 3 is pressed!
     colorWipe(strip.Color(0, 255, 0), 150);  // 35Green
            
 }

    else if (digitalRead(BUTTON4_PIN) == LOW) {
      //Button 4 is pressed!
     colorWipe(strip.Color(50, 255, 0), 50);  // 34Green
            
 }
    else if (digitalRead(BUTTON5_PIN) == LOW) {
      //Button 5 is pressed!
     colorWipe(strip.Color(50, 255, 50), 50);  // 34Green
           
 }

}
      
     



// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}

Where does the loop() function end in your code ?

If you Auto Format the code in the IDE it should make the problem clearer.

(deleted)

spycatcher2k:
You have defined a function inside loop! Why? it won’t work, move it outside of loop.

I am new to arduino programming, your help is appreciated.

I have move the “startshow” loop outside of the loop (and renamed it slightly).

Now am getting errors:

error: ‘startShow1’ was not declared in this scope

startShow1(showType);

^

and

error: expected unqualified-id before ‘else’

else if (digitalRead(BUTTON2_PIN) == LOW) {

^

// This is a demonstration on how to use an input device to trigger changes on your neo pixels.
// You should wire a momentary push button to connect from ground to a digital IO pin.  When you
// press the button it will change to a new pixel animation.  Note that you need to press the
// button once to start the first animation!

#include <Adafruit_NeoPixel.h>

#define BUTTON1_PIN   5    // Digital IO pins connected to the buttons.  These will be
#define BUTTON2_PIN   6    // driven with the internal pull-up resistor so the switch should
#define BUTTON3_PIN   7    // pull the pin to ground momentarily.  On a high -> low
#define BUTTON4_PIN   8    // transition the button press logic will execute.
#define BUTTON5_PIN   9    // Digital IO pin connected to the button.  This will be
                          // driven with a pull-up resistor so the switch should
                          // pull the pin to ground momentarily.  On a high -> low
                          // transition the button press logic will execute.

#define PIXEL_PIN    2    // Digital IO pin connected to the NeoPixels.

#define PIXEL_COUNT 60

// Parameter 1 = number of pixels in strip,  neopixel stick has 8
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_RGB     Pixels are wired for RGB bitstream
//   NEO_GRB     Pixels are wired for GRB bitstream, correct for neopixel stick
//   NEO_KHZ400  400 KHz bitstream (e.g. FLORA pixels)
//   NEO_KHZ800  800 KHz bitstream (e.g. High Density LED strip), correct for neopixel stick
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);

bool oldState = HIGH;
int showType = 0;

bool buttonAction1 = HIGH;
bool buttonAction2 = HIGH;
bool buttonAction3 = HIGH;
bool buttonAction4 = HIGH;
bool buttonAction5 = HIGH;


void setup() {
  
  pinMode(BUTTON1_PIN, INPUT_PULLUP);
  pinMode(BUTTON2_PIN, INPUT_PULLUP);
  pinMode(BUTTON3_PIN, INPUT_PULLUP);
  pinMode(BUTTON4_PIN, INPUT_PULLUP);
  pinMode(BUTTON5_PIN, INPUT_PULLUP);
  
  
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}


 void loop ()   {

   if (digitalRead(BUTTON1_PIN) == LOW) {        //Button one is pressed!
      

	// Get current button state.
 	 bool newState = digitalRead(BUTTON1_PIN);

 	 // Check if state changed from high to low (button press).
 	 if (newState == LOW && oldState == HIGH) {
 	   // Short delay to debounce button.
   	 delay(20);
  	  // Check if button is still low after debounce.
  	  newState = digitalRead(BUTTON1_PIN);
  	  if (newState == LOW) {
  	    showType++;
  	    if (showType > 9)
   	     showType=0;
  	    startShow1(showType);
  	  }
 	 }

 	 // Set the last button state to the old state.
 	 oldState = newState;
	}


            
 }

    else if (digitalRead(BUTTON2_PIN) == LOW) {
      //Button 2 is pressed!
     colorWipe(strip.Color(150, 255, 0), 50);  // button2color
           
 }
   else if (digitalRead(BUTTON3_PIN) == LOW) {
      //Button 3 is pressed!
     colorWipe(strip.Color(0, 255, 0), 150);  // button3color
            
 }

    else if (digitalRead(BUTTON4_PIN) == LOW) {
      //Button 4 is pressed!
     colorWipe(strip.Color(50, 255, 0), 50);  // button4color
            
 }
    else if (digitalRead(BUTTON5_PIN) == LOW) {
      //Button 5 is pressed!
     colorWipe(strip.Color(50, 255, 50), 50);  // button5color
           
 }

}
      
     
	 	void startShow1(int i) {
  switch(i){
 	case 0: colorWipe(strip.Color(0, 0, 0), 50);    // Black/off
             break;
   	case 1: colorWipe(strip.Color(255, 15, 15), 50);  // Pinkish
   	         break;
   	case 2: colorWipe(strip.Color(0, 255, 0), 10);  // Green
   	         break;
   	case 3: colorWipe(strip.Color(0, 0, 255), 50);  // Blue
   	         break;
   	case 4: theaterChase(strip.Color(127, 127, 127), 50); // White
   	         break;
  	case 5: theaterChase(strip.Color(127,   0,   0), 50); // Red
  	         break;
 	case 6: theaterChase(strip.Color(  0,   0, 127), 50); // Blue
 	         break;
    case 7: colorWipe(strip.Color(70, 40, 25), 50);  // color 7);
            break;
    case 8: colorWipe(strip.Color(100, 0, 55), 50);  // color 8;
            break;
    case 9: colorWipe(strip.Color(20, 166, 155), 50);  // color 9;
            break;
  }
}



// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}

You now have code outside of a function. Where does the loop() function end in your program ?