Hardware Reference
In-Depth Information
return (HEX2[triplet[0:2]],HEX2[triplet[2:4]],HEX2[tripl
et[4:6]])
def triplet(rgb):
return format((rgb[0]<<16)|(rgb[1]<<8)|rgb[2], '06x')
Whenever a click is detected, the posted hex values from the webserver
are detected as follows:
@app.route('/set/<hex_val>', methods=['GET', 'POST'])
def send_command(hex_val):
rgb_val = rgb(hex_val)
3.
The RGB values are passed to LPD8806 via the Raspberry Pi's SPI interface:
led.fill(Color(rgb_val[0],rgb_val[1],rgb_val[2],0.98))
led.update()
4. Now, when we execute the script available along in the web server sample folder,
we should be able to launch a webserver that will display a colour picker as shown
in the following diagram:
A flask framework-based RGB interface
Objective complete - mini debriefing
In this task, we inished seing up the webserver that controls the fountain. In the next task,
we will review seing up e-mail alerts through colour changes on the fountain.
It is possible to control the lights of the fountain based on a song being played on the
Raspberry Pi. How can this be achieved? Visit this topic's website for some clues.
 
Search WWH ::




Custom Search