Driving LEDs as output indicators
LED indicators can take many forms, from a single LED indicator through to complex LED X-Y arrays and digit displays. If you have multiple indicator LEDs, it is preferable to include an LED driver and even better to offload this to an I2C controller, which we will explain in Chapter 6, Driving I2CPeripherals on the Raspberry Pi. If you have just a few LEDs to drive and are short of output pins for each LED, you will want to read up on Charlieplexing as a way of reducing the port count required (http://en.wikipedia.org/wiki/Charlieplexing).
For our demo, we will use a single LED attached to a single GPIO port. We will attach it to the GPIO 26 port with a series resistor to limit the current through the device. This ...
Get Raspberry Pi Essentials 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.