Book Image

Raspberry Pi Zero Cookbook

Book Image

Raspberry Pi Zero Cookbook

Overview of this book

The Raspberry Pi Zero, one of the most inexpensive, fully-functional computers available, is a powerful and revolutionary product developed by the Raspberry Pi Foundation. The Raspberry Pi Zero opens up a new world for the makers out there. This book will give you expertise with the Raspberry Pi Zero, providing all the necessary recipes that will get you up and running. In this book, you will learn how to prepare your own circuits rather than buying the expensive add–ons available in the market. We start by showing you how to set up and manage the Pi Zero and then move on to configuring the hardware, running it with Linux, and programming it with Python scripts. Later, we integrate the Raspberry Pi Zero with sensors, motors, and other hardware. You will also get hands-on with interesting projects in media centers, IoT, and more.
Table of Contents (17 chapters)
Raspberry Pi Zero Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Connecting an LED matrix display to the RPZ


Operating one LED is fun for about a minute, but what if you want to do some really interesting things, or operate a matrix of LEDs?

Getting ready

You'd need some kind of LED matrix. There were two different matrices I tried out. The first was Adafruits's 8x8 LED display, but there was also an 8x8 LED display included in my Elego Complete Starter Kit.

Aside from that, you really only need jumper wires and Python. The 8x8 matrix commonly uses a max7219 driver. Install the Python driver library with pip:

sudo pip install max7219

How to do it...

  1. There are five pins on the LED matrix, which use your Raspberry Pi Zero's SPI interface. Connect the matrix to the RPZ as shown here:

  2. There is a great library for interfacing an 8x8 matrix using a max7219 driver in Python, appropriately named max7219. With this, it is easy to write messages or light any LED in the matrix.

  3. You can make a messaging program in just a few lines! Create a program named maxtix8x8.py...