Book Image

Raspberry Pi By Example

By : Arush Kakkar
Book Image

Raspberry Pi By Example

By: Arush Kakkar

Overview of this book

Want to put your Raspberry Pi through its paces right out of the box? This tutorial guide is designed to get you learning all the tricks of the Raspberry Pi through building complete, hands-on hardware projects. Speed through the basics and then dive right in to development! Discover that you can do almost anything with your Raspberry Pi with a taste of almost everything. Get started with Pi Gaming as you learn how to set up Minecraft, and then program your own game with the help of Pygame. Turn the Pi into your own home security system with complete guidance on setting up a webcam spy camera and OpenCV computer vision for image recognition capabilities. Get to grips with GPIO programming to make a Pi-based glowing LED system, build a complete functioning motion tracker, and more. Finally, get ready to tackle projects that push your Pi to its limits. Construct a complete Internet of Things home automation system with the Raspberry Pi to control your house via Twitter; turn your Pi into a super-computer through linking multiple boards into a cluster and then add in advanced network capabilities for super speedy processing!
Table of Contents (22 chapters)
Raspberry Pi By Example
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Using PiGlow


PiGlow has a set of female GPIO railings, which cover the Raspberry Pi's male GPIO rails. In case of Raspberry Pi 2 and B+, the size of the railing in PiGlow is shorter, so we need to make sure that PiGlow is attached to only lower numbered pins on the Raspberry Pi.

Note

You can find out more about PiGlow on the Pimoroni website at https://shop.pimoroni.com/products/piglow.

We can now proceed to control the LEDs on the PiGlow board. Open up a Python terminal and execute the following statements in a sequential order:

import piglow
piglow.red(64)

Here, we import the particular library in Python first. The red() method selects all the red LEDs on the PiGlow board. It takes only one argument, the intensity of the LEDs, which can be a number from 0 to 255. You can also try to pass the number 255 to the red() method to see how it affects the intensity of the LED. In this case, passing 0 would mean that the LED is off. But once we execute the earlier two statements, nothing will happen...