Help programming project with arduino mega 2560

Hi, I’m new programming arduino and I have a problem trying to program a lcd display, BCD thumbwheel single digit code (0 to 9) and mp3 shield sparkfun, I have programmed each thing and they work fine. now I tried to program all things together and the lcd and thumbwheel switch works but when I try to play the audio with A0 input it doesn’t play the audio and I’m stuck there.

This is a project for a silhoutte shooters club. I need the thumbwheel switch to enter the number of shooters and with another switch call the shooters with audio.

attached is the code I have.

thank you

prueba.ino (1.66 KB)

#include <LiquidCrystal.h>
#include <SPI.h>
#include <SdFat.h>
#include <SFEMP3Shield.h>
#include <Bounce2.h>

#define q1 28
#define q2 26
#define q4 24
#define q8 22

#define B_PLAY A0
#define BUTTON_DEBOUNCE_PERIOD 20 //ms

SdFat sd;
SFEMP3Shield MP3player;
Bounce b_Play = Bounce();
int8_t current_track = 0;

const int rs = 10, en = 5, d4 = 46, d5 = 44, d6 = 42, d7 = 40;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
// set up the LCD’s number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print(" Presiona Call");
delay(1000);
lcd.setCursor(0,1);
lcd.print(" para comenzar");

Serial.begin(9600);
Serial.println(readSwitch()); // sends switch value to serial monitor box
pinMode(q1, INPUT); // thumbwheel ‘1’
pinMode(q2, INPUT); // thumbwheel ‘2’
pinMode(q4, INPUT); // thumbwheel ‘4’
pinMode(q8, INPUT); // thumbwheel ‘8’
}
int readSwitch()
{
int total=0;
if (digitalRead(q1)==HIGH) { total+=1; }
if (digitalRead(q2)==HIGH) { total+=2; }
if (digitalRead(q4)==HIGH) { total+=4; }
if (digitalRead(q8)==HIGH) { total+=8; }
return total;

Serial.begin(9600);

pinMode(B_PLAY, INPUT_PULLUP);

b_Play.attach(B_PLAY);
b_Play.interval(BUTTON_DEBOUNCE_PERIOD);

if(!sd.begin(9, SPI_HALF_SPEED)) sd.initErrorHalt();
if (!sd.chdir("/")) sd.errorHalt(“sd.chdir”);

MP3player.begin();
MP3player.setVolume(10,10);

Serial.println(F(“Looking for Buttons to be depressed…”));

}

void loop() {

if (b_Play.update()) {
if (b_Play.read() == LOW) {
Serial.print(F("B_PLAY pressed, Start Playing Track # "));
Serial.println(current_track);
MP3player.playTrack(current_track);

}
}
}

Hi Miguel, to help people help you, edit your last post and put [code] and [/code] before and after your code listing. This will format it and make sure that there are no forum-software induced errors.