Arduino buttons not working

I used 3 buttons to do test, the first button not work, I mean when pressed button1, no response, there is a sound when pressed the button2 and button3. Why?

The buttons wired at A0/A1/A2, and the Piezoelectric Ceramics wired at pin9 and gnd.

Thanks

int speaker = 9;
int frequency = 2800; //


const int testing_button = A0;
const int melody_button = A1;      //melody
const int testing_a_button = A2;    //Mosquitoes, Fleas, House Fly, Spiders, Cockroaches

boolean pressed = false;

void setup()
{

  Serial.begin(9600);
  Serial.println("setup"); // Prints "Setup to the serial monitor"

  pinMode(testing_button, INPUT_PULLUP);
  pinMode(melody_button, INPUT_PULLUP);
  pinMode(testing_a_button, INPUT_PULLUP);

  pinMode(speaker, OUTPUT);
  ///////////////////////

  digitalWrite(testing_button, HIGH);
  digitalWrite(melody_button, HIGH);
  digitalWrite(testing_a_button, HIGH);

}

void loop() {

  int buttonState0 = digitalRead(testing_button);
  if (buttonState0 == LOW) {

    tone(speaker, frequency, 1000); // f=3100

    pressed = true;
  }

  int buttonState1 = digitalRead(melody_button);
  if (buttonState1 == LOW) {

    tone(speaker, frequency, 1000); // f=3100

    pressed = true;
  }

  int buttonState2 = digitalRead(testing_a_button);
  if (buttonState2 == LOW) {

    tone(speaker, frequency, 1000); // f=3100

    delay(5);

    pressed = true;
  }

  
  if (pressed) {
    digitalWrite(13, true);      // Flash a light to show transmitting
    //  vw_send((uint8_t *)msg, strlen(msg)); //Sending the message
    // vw_wait_tx(); // Wait until the whole message is gone
    //    Serial.println(*msg);
    digitalWrite(13, false);   // Turn the LED off.
    delay(5);
  }
}

Show your schematic.

if (pressed) {
    digitalWrite(13, true);      // Flash a light to show transmitting
    //  vw_send((uint8_t *)msg, strlen(msg)); //Sending the message
    // vw_wait_tx(); // Wait until the whole message is gone
    //    Serial.println(*msg);
    digitalWrite(13, false);   // Turn the LED off.
    delay(5);
  }

You only flash your light for a few hundred nanoseconds. Nobody is going to see that.

Delta_G:

if (pressed) {

digitalWrite(13, true);      // Flash a light to show transmitting
    //  vw_send((uint8_t *)msg, strlen(msg)); //Sending the message
    // vw_wait_tx(); // Wait until the whole message is gone
    //    Serial.println(*msg);
    digitalWrite(13, false);  // Turn the LED off.
    delay(5);
  }




You only flash your light for a few hundred nanoseconds. Nobody is going to see that.

Thanks

Actually I disabled the flashing.
I have a long tone of : tone(speaker, frequency, 1000); // f=3100 for each button, only the first button doesn't work, even shift the 1/2 as 2/1 still the first button no work.

Show your schematic.

larryd:
Show your schematic.

Delta_G:

Sorry, I am trying to open my PROTEUS but failed.

laoadam:
Sorry, I am trying to open my PROTEUS but failed.

You can just draw it, you know with a pencil and paper like we did in the old days. Sometimes that's easier. And we'd definitely prefer that to something like Fritzing. Whatever you do, make it accurate. Don't put things in wrong just because whatever you're using doesn't have the parts you used.