Book Image

Raspberry Pi Essentials

By : Jack Creasey
Book Image

Raspberry Pi Essentials

By: Jack Creasey

Overview of this book

Table of Contents (15 chapters)
Raspberry Pi Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 is what your breadboard should look like, along with the schematic:

When the GPIO pin number 26 is high, the LED is off, and when it is low, a current of approximately 4 mA flows from the 3.3V supply through the LED and into the GPIO pin to the ground...