Book Image

Internet of things with Intel Galileo

Book Image

Internet of things with Intel Galileo

Overview of this book

This book employs an incremental, step-by-step approach to get you familiarized with everything from the basic terms, board components, and development environments to developing real projects. Each project will demonstrate how to use specific board components and tools. Both Galileo and Galileo Gen 2 are covered in this book.
Table of Contents (12 chapters)
11
Index

Controlling the LED strip


Now that we've finished wiring the LED strip to the Galileo board properly, let's see how we can control it by filling it all red.

For this project, we'll be using Node.js and the LPD8806 UPM library.

Note

You can find the LPD8806 UPM library Node.js documentation at http://iotdk.intel.com/docs/master/upm/node/classes/lpd8806.html. Under the Methods tab, you'll find all the available methods.

This library uses the MRAA library SPI module (http://iotdk.intel.com/docs/master/mraa/node/classes/spi.html) and provides a simple way to interact with the strip, abstracting the SPI writing process. It works by filling an array of pixels with color information and writing it to the SPI bus. You can set up each LED individually using the setPixelColor(pixelPosition, Red, Green, Blue) method and actually write to the strip using the show()method.

Let's try creating a simple script to make the strip completely red. Connect to your Galileo using SSH and create a new folder named chapter7...