Here's how to blink an LED connected to the GPIO bus on the Raspberry Pi using Python.
Description#
There's actually a few web pages that show how to do this — you could just search. But here's
one that gives the Python code that shows how to use a keyboard interrupt, so you can Control-C
and break out of the loop (properly).
Steps#
- We're going to connect an LED to one of the spare pins on the GPIO bus of the Raspberry Pi, using a resistor to drop the voltage to a safe level for the LED (they can't handle the 3.3 volt power supply directly)
- we'll next create a Python script called 'blink.py'
- we'll execute the script to see the LED blink
- a bit of troubleshooting is warranted
How to...#
Links#