How to Use Push Buttons With Raspberry Pi GPIO (with Python gpiozero)
M Heidenreich M Heidenreich
2.35K subscribers
39,885 views
0

 Published On Nov 5, 2020

This video is an introduction to how to use buttons with the Raspberry Pi.
I am a big fan of the gpiozero library and dislike RPi.GPIO. And it shows!

0:00 Intro
0:14 How to do it wrong!
1:40 Why infinite while loops are bad
2:20 Why I dislike RPi.GPIO
3:10 Why gpiozero is the right choice
3:48 Event-driven programming primer
4:20 Basic gpiozero button program
5:38 Button press event handling
7:34 Callbacks with lambda:
8:15 User-defined event callback
8:55 Putting it all together
9:50 Full code

Complete code: https://github.com/mheidenreich/Butto...
(Note: code posted may contain small updates and/or bug fixes not shown in the video)

Disclaimer:
"Raspberry Pi" and the distinct logo are a trademark of the Raspberry Pi Foundation.

Music: Pull Up Riddim by Konrad OldMoney, YouTube Music Library

show more

Share/Embed