Control an LED Using the GPIO Pins

Making an LED shine is a fun exercise, but it gets boring pretty quickly. In this section, you’ll learn how to control an LED using software—we’ll turn it on and off by issuing commands on the Pi.

Programming hardware directly is usually a difficult task. Using the WiringPi project,[112] it becomes a piece of cake. WiringPi is an open-source project that hides the ugly low-level functions behind a nice, clean interface. If you’ve worked with the popular Arduino project[113] before, WiringPi will look very familiar because it tries to bring most of the Arduino goodies to the Pi. WiringPi not only makes programming the Pi’s hardware easier, but it also comes with a small command-line utility named gpio that ...

Get Raspberry Pi, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.