Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

Detect when a Push Button is Pressed with Python – Raspberry Pi 5 Tutorial (#9)

3.6K views on YouTube

In this Raspberry Pi tutorial you will learn how to detect if a push button is pressed or not, using the gpiozero Python library.

🔥 Complete Raspberry Pi 5 Course for Beginners 👉 https://rbcknd.com/raspberry-pi-for-beginners

👉 Raspberry Pi Tutorial Playlist: https://www.youtube.com/playlist?list=PLLSegLrePWgIDKJTkdLyyQskh2HDdEL3y

⏱️ Chapters
(00:00) Setup the button with gpiozero
(01:49) Detect if button is pressed
(02:58) Print the button’s state every second

👉 Get all my courses here 👉 https://rbcknd.com/all-courses

Twitter: https://twitter.com/RoboticsBackend
More Free Tutorials: https://roboticsbackend.com