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

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

Images