from picozero import Speaker
from time import sleep
# Set up the speaker on GPIO pin 15
speaker = Speaker(15)
# Set the frequency for the beep (change this value to adjust the tone)
frequency = 100 # Hz
# Continuously beep with a 1-second interval
while True:
speaker.on(frequency) # play the chosen frequency
sleep(1) # wait for 1 second
speaker.off() # turn off the sound
sleep(1) # wait for 1 second before the next beep