RPI.GPIO Credit: https://pypi.org/project/RPi.GPIO
Master RPi.GPIO
Les Pounder goes back to the early days of the Raspberry Pi – and his career – with this classic library!
300 issues of Linux Format
OUR EXPERT
Les Pounder is associate editor at Tom’s Hardware and a freelance maker for hire. He blogs about his adventures and projects at http://bigl.es.
Python and Raspberry Pi go hand in hand. In the early days of the Pi, there was one P Python library that dominated the maker and educational scene: RPi.GPIO. It was quickly adopted by Raspberry Pi as the de facto standard means to interact with the GPIO via Python. In this tutorial, we’ll go back to the early days to learn how this communitycreated project can be used with LEDs and buttons. We’ll also talk a little about how RPi.GPIO came to be.
Project 1: Blinking LEDs
The Hello World of hardware hacking is to blink an LED and we continue this great tradition now. This project is useful to debug hardware and software before moving on to more difficult projects. Our goal is to blink an LED 10 times, and with each change of state (LED on, LED off), we print the state to the Python shell. Doing so, we confirm the code is working as it prints the message. If the LED fails to light, we have a hardware issue.