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...