#define BUZZER_PIN PA5 // Buzzer pin
#define BUTTON_PIN PB0 // Push button pin
void setup() {
pinMode(BUZZER_PIN, OUTPUT); // Set Buzzer pin as output
pinMode(BUTTON_PIN, INPUT_PULLUP); // Set button pin as input with pull-up resistor
}
void loop() {
if (digitalRead(BUTTON_PIN) == LOW) { // Check if button is pressed
tone(BUZZER_PIN, 1000); // Play sound at 1000 Hz
delay(100); // Sound duration
noTone(BUZZER_PIN); // Stop sound
}
}