rpi_zero_neopixel_buzzer/detect_buzz.py

12 lines
250 B
Python
Raw Normal View History

2024-03-24 22:27:13 +01:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
2024-03-24 22:32:51 +01:00
"""
Using GPIO to detect button
See https://gpiozero.readthedocs.io/en/stable/api_input.html
"""
2024-03-24 22:27:13 +01:00
from gpiozero import Button
buzzer = Button(16)
2024-03-24 22:32:51 +01:00
buzzer.wait_for_press()
2024-03-24 22:27:13 +01:00
print("The button was pressed!")