Pi GO
Using the GPIO with Go
Les Pounder is ready to go! By which we mean he’s keen to try out the Google-developed alternative programming language to Python.
OUR EXPERT YOU NEED
Les Pounder is associate editor at Tom’s Hardware and a freelance maker for hire. He blogs about his adventures and projects at bigl.es.
YOU NEED
> Raspberry Pi
> The latest Raspberry Pi OS 3 x LEDs
> 3 x 220 Ohm Resistors (Red-Red- Black-Gold)
> 6 x Female to male jumper wires
> Breadboard
> The code: https://github.com/lesp/LXFGo-Raspberry-Pi-GPIO/archive/refs/heads/main.zip
Think Pi coding, think GPIO, think Python, right? Python isn’t the only way to access the GPIO. In this tutorial we’ll use Go, a flexible and easyto-use alternative to Python. We’ll learn how projects are built, how to import modules of code and write projects that interact with the Raspberry Pi’s GPIO. Before we install Go, it’s best practice to ensure that our system is up-to-date. Open a terminal and run the following commands to update the list of repositories and then install the latest software. Note: this can take a while.
Visit https://go.dev/dland download go1.19.linuxarmv6l.tar.gz to your Downloads directory. At the time of writing this was the latest version of Go for Arm-based 32-bit CPUs.