Installing RPi.GPIO
You want to be able to set the output of GPIO pins and read the input values using Python.
Download and install the RPi.GPIO Python library.
From a Terminal window on your Pi, type the following commands to fetch and install the RPi.GPIO library.
$ sudo apt-get install python-dev $ sudo apt-get install python-rpi.gpio |
Note that the latest versions of many distributions may have RPi.GPIO already installed. If this is the case, then the preceding commands will just update it to the latest version.
Discussion
This library will be used throughout the book. The library uses native C wrapped in Python to make the IO as fast as possible. However, the Pi is not really designed as a microcontroller, so the GPIO pins will not respond as quickly as an Arduino.
See Also
An alternative library that performs much the same job as RPi.GPIO is WiringPi. You can find out more about the library at Gordons Projects.
Many of the recipes in this book use the RPi.GPIO library.