Cheerlights in a few lines of Python code
-
I love the Cheerlights project (http://cheerlights.com/) which lets you connect your Christmas lights to a worldwide IoT network, controlled via Twitter
I got my Omega2 the other day and was playing around with it...I realized the RGB LED on the Expansion dock would be perfect for a mini Cheerlights client. So, here's the code...
-
import urllib import os import time link = "http://api.thingspeak.com/channels/1417/field/2/last.txt" while (True): f = urllib.urlopen(link) color = f.read() color = color.replace("#", "0x") print "Setting LED to " + color os.system("expled " + color) time.sleep(5)
-
(Is there no way to mark a block of code on this forum?)
-
@Leif-Bloomquist said in Cheerlights in a few lines of Python code:
(Is there no way to mark a block of code on this forum?)
Blocks of code are fenced by lines with three back-ticks
```
in Markdown.
See also theCOMPOSE
button on the top right corner please
-
@György-Farkas Got it,thank you!!