Small python web DMX Controller for Raspberry Pi 3
Edit file
$ sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
To be :
@xset s noblank
@xset s off
@xset –dpms
@chromium-browser --kiosk --app=http://localhost:5000/?raspberrypi=true
A program is a set of channels associated to expressions.
Channels and values are based on evil eval
where elapsed(step=0)
is time in seconds.
Using values higer than zero for step
will quantize time accordingly, allowing step changes.
Each frame, values are computed according to selected program and expressions.
Functions available :
cos2(x)
:math.cos
expressed between 0.0 and 1.0, to avoid negative valuessin2(x)
:math.sin
expressed between 0.0 and 1.0, to avoid negative valuesrandint(min, max, step=0)
:random.randint
whereelapsed(step)
is used to seed the random generatorchoice(iterable, step=0)
:random.choice
whereelapsed(step)
is used to seed the random generatorlerp(start, end, factor)
: performs a linear interpolation fromstart
toend
, given thefactor
Universe expressions are not reset each program change, which means that for blackout you need to assign "0"
to all relevant channels
This allows to fire specific fixtures without affecting other fixtures (see Smoke on / off in example)
Expressions are computed in float
from 0.0 to 1.0, except if the expression starts with $
. Then, expression ranges from int
0 to 255
This allows to express precise values for specific fixture programs (see Absolute values in example)
Spaces are not allowed in program names but underscores are replaced with spaces in UI captions
{
"Blackout": {
"range(1, 256)": "0"
},
"Color_rotation" : {
"1": "0.5 * math.cos(elapsed * math.pi * 0.25) + 0.5",
"2": "0.5 * math.cos(elapsed * math.pi * 0.25 + math.pi) + 0.5",
"3": "1.0 if elapsed % 1 > 0.5 else 0.0"
},
"Strobe": {
"range(1, 4)": "1.0 if elapsed % .1 > 0.05 else 0.0"
},
"Smoke_on": {
"16": "1"
},
"Smoke_off": {
"16": "0"
},
"Absolute_values" : {
"1": "$128",
"2": "cos2(elapsed)",
"3": "sin2(elapsed)"
}
}