User Guide
Table Of Contents
161
3. You have an appropriate value resistor. If the
resistance is too great, you won’t be able to see
that the LED is on.
So far, you are using the Pi as a battery. But now that you know
your circuit works, you can place the LED under the Pi’s control:
1. Shutdown the Pi and unplug it from the power.
2. Disconnect the red 3.3 V wire from header pin 1,
and then connect it to pin 3 (GPIO2).
3. Plug the power back into the Raspberry Pi, and
allow Raspbian to load.
When the Pi boots, GPIO2 is often brought high. A high signal is
3.3 V, a low signal is connected to ground (0 V).
Controlling GPIO2 from a Terminal Window
You can control the GPIO pins from a terminal window in
Raspbian. But only the superuser can do this. For more
information about users and superusers, see Understanding
Linux Users and Superusers on page35.
If you want to control the pins from the terminal, you first need
to export the pin. This creates a special folder in the file system
that you can use to change the pin from an input to an output,
send the pin high, or send the pin low.
1. On the Application Launcher, click LXTerminal.
2. Type the following command and then press Enter:
sudo su
3. Type the following command and then press Enter:
echo 2 > /sys/class/gpio/export
4. Type the following command and then press Enter:
ls /sys/class/gpio/gpio2
The files that you see in the gpio2 directory control the state of
GPIO2. When exporting GPIO pins, the number you use is the
GPIO number not the pin number.