Hardware Reference
In-Depth Information
Engage thrusters
1.
The Raspberry Pi needs to be connected to the SPI interface of the Raspberry Pi.
The RGB LED strip has to be powered by a 5V DC adapter. The clock pin CI needs to be
connected to the clock pin of the Raspberry Pi (pin 14, SCK pin of the Raspberry Pi).
The clock pin CI needs to be connected to the clock pin of the Raspberry Pi
(pin 14 of the GPIO header, SCK pin of the Raspberry Pi).
The data pin DI (Data In) needs to be connected to the MOSI pin (pin 12 of
the GPIO header) of the Raspberry Pi.
The GND (ground pin) of the RGB LED strip needs to be connected to the
GND (ground pin) of the GPIO header of the Raspberry Pi.
Connecting the RGB LED Strip to the Raspberry Pi using a Pi Cobbler
2. In order to control the lighing arrangement, let's make use of the Circadian lighing
project's Python script and Adam Haile's LPD8806 library. We will get started by
imporing the Flask framework and the LPD8806 library. We will iniialize the LPD8806
library by seing the number of digitally addressable RGB LEDs used in this project:
num = 64
led = LEDStrip(num)
The circadian lighting project ( http://rasathus.blogspot.
com/2013/02/nasa-style-circadian-lighting-wrap-up.html )
uses a color picker (based on Raphael.js ) and a color is set on mouse click.
The clicks on the color picker wheel are converted into RGB values as follows:
rgb_array = [0,0,0]
HEX = '0123456789abcdef'
HEX2 = dict((a+b, HEX.index(a)*16 + HEX.index(b)) for a in
HEX for b in HEX)
def rgb(triplet):
triplet = triplet.lower()
rgb_array[0] = HEX2[triplet[0:2]]
rgb_array[1] = HEX2[triplet[2:4]]
rgb_array[2] = HEX2[triplet[4:6]]
 
Search WWH ::




Custom Search