Learn

A pin on the Raspberry Pi can be used as an output, meaning that it can “send” an electrical signal to the outside world.

When used as an output, a GPIO pin on the Raspberry Pi is capable of only being in two states: HIGH or LOW.

A pin in the HIGH state means it provides 3.3V in reference to Ground. This is the equivalent of connecting something to the positive side of a 3.3V battery.

A pin in the LOW state means the pin provides 0 volts. This is the equivalent of connecting something directly to Ground.

Labeled diagram of the general-purpose input-output pins

Looking at the above diagram again, we can see there are a few pins on the GPIO port that are dedicated to being either HIGH or LOW (you can’t change their state). These are the 3.3V and Ground pins.

The rest of the pins are numbered GPIO pins that can be designated HIGH or LOW by software on the Raspberry Pi.

In the next exercise, we will turn the LED on and off by changing the state of the GPIO pin using the programming language Python.

Instructions

The LED circuit on the breadboard is now connected to GPIO23 on pin 16 and Ground on pin 20. The is no button in the circuit so the LED will light when GPIO23 is HIGH.

Before we get to changing GPIO pin states using code, you can change the state by clicking the image. What effect does the pin state have on the circuit?

A HIGH state applies a voltage across the load of the circuit and the LED turns on. Remember the load consists of the resistor and the LED.

A LOW state applies 0V, which result in no current and the LED turns off.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?