Setting Buzzer with Piano Note (in series connection with led, vibration sensor)

Hello!
We connected a vibration sensor as an input and a led,buzzer as an output.
We have to make 8 sets of this different input and output.We have 1set now in this coding though.
For the coding, we made it as a series connection so the led and the buzzer is connected with each other in the coding and as an output with the name under ledPin.
However, we encountered a problem when we tried to set the buzzer a certain note like C4 on the piano.
We tried most of the ways on the internet to set the buzzer as a note but all failed..
Is it because we tried to series connect the buzzer and the led?? or is it just a problem of our whole coding..we are very beginners at these things.. :cry: :fearful: :cry:

Here is our code. This version is the one without any certain notes of the buzzer.
For us, this code worked of sensing the vibration sensor and turning on the led and the buzzer when they sensed a vibration.
We will also attach the photo of our connection!

int ledPin = 13;
int sensorPin = 5;
boolean motionDetected = false;

void setup() 
{ 
  pinMode(ledPin, OUTPUT); 
  pinMode(sensorPin, INPUT); 
}

void loop() 
{
  int value = digitalRead(sensorPin); 
  
  if(value == HIGH) 
  { motionDetected = true; } 
    else 
    { motionDetected = false; }

  if(motionDetected == true) 
  { 
  digitalWrite(ledPin, HIGH);
  delay(500);
  digitalWrite(ledPin, LOW);
  motionDetected = false;
   } 
    else 
    { digitalWrite(ledPin, LOW); }
}

We will also attach the photo of our connection!

When?

For the coding, we made it as a series connection so the led and the buzzer is connected with each other in the coding

It makes NO sense to talk about a series connection IN CODE.

However, we encountered a problem when we tried to set the buzzer a certain note like C4 on the piano.

What was the problem?