bullwhe.blogg.se

Micro 800 interrupts example
Micro 800 interrupts example






micro 800 interrupts example

This will give you a clean start with the latest version of RPi.GPIO. The best way to get the latest RPi.GPIO (currently 0.5.5) is to flash a new SD card with the latest NOOBS or Raspbian. Sudo apt-get upgrade (This will update all your Raspbian packages and may take up to an hour) If you need to, you can install 0.5.2a or later with You can exit the python environment with CTRL+D Install RPi.GPIO version 0.5.2a for multiple threaded callback interrupts You need 0.5.1a or higher for this example. This should show you what RPi.GPIO version you have. You can check what version of RPi.GPIO you have in the command line with… If you didn’t do it for the first or second examples, you will quite likely need to update your RPi.GPIO package. We’ve used all the same building blocks we developed in parts 1 and 2, including button debouncing. So when you press button 3 it’s “game over”, but buttons 1 and 2 just report that they’ve been pressed until button 3 is eventually pressed.Ĭircuit for 2 threaded callbacks and one wait interrupt The bottom button, connecting port 24 to 3V3 on button press is the “wait for” interrupt this time. These are the two which trigger callbacks. The top two buttons connect port 17 and port 23 to GND when pressed. This circuit is a bit different from the previous one. You do a bit at a time, test it, fix it, make sure it does what it ought to do, then go on to the next bit. We’re just building on what we did before and this is exactly how programs are made. (Well actually the number of GPIO ports is probably the limit.) After that, your imagination is the limit. This is just to show that you can do multiple threaded callbacks in one program. We’ll add another button and another threaded callback function the same as the first one (but on a different GPIO port). Well actually, we’re not doing much that’s very different from last time, except, now there’s more of it. “WoooooooooOOOOOOOOOOOOOOOooooooooooo”, I hear you say. We covered a simple “wait for” interrupt in part 1, threaded callback interrupt and button debouncing in part 2 and today we’re getting sophisticated with multiple threaded callbacks. We’ve been learning about interrupts this week because of the brand new interrupt capabilities of RPi.GPIO. Multiple threaded callback interrupts in Python








Micro 800 interrupts example