def transmission_start_end(): tbuzzer = TonalBuzzer(22) led.blink(0.025, 0.025) tbuzzer.play(Tone(frequency=500)) sleep(3) led.off() tbuzzer.stop() tbuzzer.close() return render_template('json.html')
#!/usr/bin/env python from gpiozero import TonalBuzzer from gpiozero.tones import Tone from time import sleep buzzer = TonalBuzzer(pin=21, initial_value=None, mid_tone=Tone('A4'), octaves=1) print("Playing: A4...") buzzer.play(Tone("A4")) sleep(1) print("...B4") buzzer.play("B4") sleep(0.5) print("...C4") buzzer.play(Tone(frequency=523)) sleep(0.5) print("...E4") buzzer.play("E4") sleep(1) print("Done, exiting...") buzzer.stop() buzzer.close() exit()