From the course: Raspberry Pi Weekly

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Input polling vs. interrupts

Input polling vs. interrupts - Raspberry Pi Tutorial

From the course: Raspberry Pi Weekly

Input polling vs. interrupts

Hi. I'm Mark Niemann-Ross, and welcome to this week's edition of Raspberry Pi Weekly. Every week, we explore the Raspberry Pi and share useful tips. If you learned to program on a desktop or laptop computer, you may not be familiar with using interrupts, instead of polling. Desktop programming environments rarely support interrupts, but that's where the Raspberry Pi differs. With the Raspberry Pi GPIO, you can react to these interrupts in way you can't with other computers. Let's spend a bit of time exploring how to use interrupts with Python. If you're not clear on the difference between interrupts and polling, I highly recommend Barron Stone's chapter, titled Polling and Event-Driven Programming from his excellent Programming Foundations: Real-World Examples. For this discission, I've created a circuit with an HC-SR04, an LED, and a simple push-button. I've included a handout that describes how to build this…

Contents