Browse Source

First pass at controlling the FireStar

master
Glen Whitney 2 years ago
parent
commit
10076aa667
  1. 4
      README.md
  2. 90
      firestar.py
  3. 20
      info/SSDedges.mtl
  4. 87731
      info/SSDedges.obj

4
README.md

@ -1,3 +1,5 @@
# FireStar
code to drive a light show on the edges of a small stellated dodecahedron, each with a Phillips Hue lightstrip embedded in it.
code to drive a light show on the edges of a small stellated dodecahedron, each with a Phillips Hue lightstrip embedded in it.
This project depends on the phue package (https://github.com/studioimaginaire/phue) which you should be able to install via `sudo pip3 install phue`.

90
firestar.py

@ -0,0 +1,90 @@
#!/usr/bin/python3
from phue import Bridge
import time
b = Bridge('172.18.152.190')
Nedges = 30;
edgecode = [None] * Nedges;
# The edges are numbered as in info/SSDedges.obj; enter the two-letter code for
# the lightstrip inserted through each edge in the block below:
edgecode[ 0] = 'XX';
edgecode[ 1] = 'XX';
edgecode[ 2] = 'XX';
edgecode[ 3] = 'XX';
edgecode[ 4] = 'XX';
edgecode[ 5] = 'XX';
edgecode[ 6] = 'XX';
edgecode[ 7] = 'XX';
edgecode[ 8] = 'XX';
edgecode[ 9] = 'XX';
edgecode[10] = 'XX';
edgecode[11] = 'XX';
edgecode[12] = 'XX';
edgecode[13] = 'XX';
edgecode[14] = 'XX';
edgecode[15] = 'XX';
edgecode[16] = 'XX';
edgecode[17] = 'XX';
edgecode[18] = 'XX';
edgecode[19] = 'XX';
edgecode[20] = 'XX';
edgecode[21] = 'XX';
edgecode[22] = 'XX';
edgecode[23] = 'XX';
edgecode[24] = 'XX';
edgecode[25] = 'XX';
edgecode[26] = 'XX';
edgecode[27] = 'XX';
edgecode[28] = 'XX';
edgecode[29] = 'XX';
# End of edge codes; show automation follows
edges = [ b[code] for code in edgecode ]
def hueint(frac): return int(frac*65535)
# A "setting" is a pair of a list of N lists of edges, and a list of N dicts
# understandable by Bridge.set_light,
# e.g. {'bri' : 127, 'hue' : 43690, 'sat' : 224},
# which means to set the ith list of edges to the ith dict.
# Note the list of lists does not have to be a partition; edges not mentioned
# in any list will be left alone.
alltogether = [range(0,Nedges)];
thevoid = (alltogether, ['bri' : 0])
deepblue = (alltogether, [{'hue' : hueint(2/3), 'bri' : 254, 'sat' : 254}])
yelorng = (alltogether, [{'hue' : hueint(1/6), 'bri' : 254, 'sat' : 254}])
redred = (alltogether, [{'hue' : 0, 'bri' : 254, 'sat' : 254}])
# A "simpleshow" is a pair of a list of settings, and a list of triples of
# integers: (setting_index, transition_to, hold_time)
# where setting_index is an index into the list of settings, and transition_to
# and hold_time are times in deciseconds to take to morph to the given
# setting, and then hold at the given setting before the next step of the
# simpleshow.
intro = ([thevoid, deepblue, yelorng, redred],
[(0,1,0), (1,30,20),
(2,1,3), (1,1,3), (2,1,3), (1,1,3), (2,1,3), (1,1,3), (2,1,0),
(3,50,20), (0,30,5)]
)
def runsimple(ss):
'''Takes one argument, a simple show; causes the simple show to be
executed on the FireStar
'''
settings = ss[0]
for (setting_index, transition_to, hold_time) in ss[1]:
theset = settings[setting_index]
subs = theset[0]
cmds = theset[1]
nsubs = length(subs)
for i in range(0,nsubs):
thiscmd = cmds[i].copy()
thiscmd['transitiontime'] = transition_to
b.set_light([edges[e].light_id for e in subs[i]], thiscmd)
time.sleep(hold_time/10)
runsimple(intro)

20
info/SSDedges.mtl

@ -0,0 +1,20 @@
# Blender MTL File: 'SSDedges2.blend'
# Material Count: 2
newmtl None
Ns 500
Ka 0.8 0.8 0.8
Kd 0.8 0.8 0.8
Ks 0.8 0.8 0.8
d 1
illum 2
newmtl color_16777215
Ns 0.000000
Ka 1.000000 1.000000 1.000000
Kd 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.0 0.0 0.0
Ni 1.450000
d 1.000000
illum 1

87731
info/SSDedges.obj

File diff suppressed because it is too large
Loading…
Cancel
Save