Hardware Reference
In-Depth Information
In the LXTerminal window opened from the Raspberry Pi Desktop, type this code:
sudo python
import RPi.GPIO as GPIO
GPIO.RPI_REVISION
A
Using sudo in the command sudo python runs Python as the root or super
user so that it can gain access to the GPIO hardware, which is not accessible to
a normal user.
he irst line runs the Python interpreter in interactive mode, while the second line
uses import to use the RPi.GPIO library. he last line will determine what revision of
Raspberry Pi you are using. Figure 8-6 shows this code and the output. he Raspberry
Pi in this igure has returned the value of 2 , meaning that it is a Raspberry Pi Rev 2
board.
FIGURE 8-6 Using GPIO.RPI_REVISION in LXTerminal to ind out which
Raspberry Pi revision you have
To close the Python shell, type:
quit()
Search WWH ::




Custom Search