
Python is capable of running more than one thread at once. The program only had one thread, which means only one thing was being done at once. So, while it was waiting, the program wasn’t doing anything else. If you remember the previous example program was just a simple “wait for port 23 to be connected to GND when we press the button and then print a message and exit the program”. And it probably is complicated in the C code it’s written in, but we’re Pythonites and we don’t have to go there. Threaded callback – what the heck is that?

In this second article I will introduce “threaded callback” which opens up a lot of new possibilities.

In the previous article I explained the basics of using interrupts in RPi.GPIO and gave an example of a simple “wait for an event” interrupt program.

Interrupts are an efficient way for a program to be able to respond immediately to a specific event.
