Blinking LED with Raspberry Pi
Introduction
In this tutorial you will learn how to connect a LED to your Raspberry Pi’s GPIO pin and make it blink using Python.
Required Hardware
- Raspberry Pi (any model)
- Breadboard
- LED (any colour)
- Female to male jumper wires
- 470Ω Resistor
- microSD card with Raspbian installed
Wiring
Code
On your Raspberry Pi, open a terminal window. Install python by the following commands.
sudo apt-get update
sudo apt-get install -y python-dev python-rpi.gpio
Download and save this file on your desktop
With the following commands you can execute the Python script that makes the LED blink:
cd Desktop
python blink.py
The LED will blink every second. Press Ctrl + C to terminate the execution of the Python script