Question 8.3: Installing RPi.GPIO You want to be able to set the output of......

Installing RPi.GPIO

You want to be able to set the output of GPIO pins and read the input values using Python.

Step-by-Step
The 'Blue Check Mark' means that this solution was answered by an expert.
Learn more on how do we answer questions.

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.

Related Answered Questions

Question: 8.16

Verified Answer:

The PiFace Digital (“Modules” on page 381) is an e...
Question: 8.15

Verified Answer:

Use a boost regulator module (Figure 8-10). The mo...
Question: 8.14

Verified Answer:

A typical project using a Raspberry Pi requires 5V...
Question: 8.11

Verified Answer:

Use a Pi Cobbler, a device consisting of a small p...
Question: 8.9

Verified Answer:

Install Minicom: $ sudo apt-get install minicom...
Question: 8.21

Verified Answer:

You can use the paddle terminal breakout board sho...
Question: 8.20

Verified Answer:

The Pi Plate (Figure 8-16) is a prototyping board ...
Question: 8.19

Verified Answer:

The Humble Pi (Figure 8-15) is a prototyping board...
Question: 8.17

Verified Answer:

Figure 8-13 shows a Gertboard attached to a Raspbe...