Using the uDMX commandline interface and PHP it is fairly easy to build a system to control your lights from a ordinary web browser. In this post I show you how to put a slider on a web page that controls the first channel of your DMX light dimmer. This is not a very useful application, but throw in some more Ajax and a database of your choice, et voilà: A web based lighting desk…
Compile the uDMX command line tool for your operating system
cd UDMX_SOURCE/commandline/
make
Move the command line tool to a directory thats accessible by PHP (for example into your web directory, something like /var/www/ on LINUX or /Library/WebServer/Documents/ on MacOSX) and make sure it is executable
mv uDMX /var/www/uDMX
sudo chmod a+x /var/www/uDMX
Next we’ll write a php script that takes some arguments and calls the udmx command line tool
file udmx.php:
<?php
if (isset($_GET['start_channel'])) {
// get the arguments to our script and make sure we get only
// numbers, to prevent arbitrary code execution
$cmd = preg_replace('/\D/i','',$_GET['start_channel']).' ';
$cmd .= implode(preg_replace('/\D/i','',$_GET['value']),' ');
//run the command line tool with our arguments
exec('./uDMX '. $cmd);
}
?>
include the scriptaculous and protpotype libraries in the header of your html and put this slider on your page:
<div id="slider" style="position:relative;width:255px;
height:20px;border:1px solid black">
<div id="handle" style="position:relative;width:18px;
height:18px;border:1px solid black">
</div>
</div>
<div id='response'></div>
<script type="text/javascript" language="javascript">
var slider = new Control.Slider('handle','slider',{
axis: 'horizontal',
sliderValue : .0,
onChange : function(v){
v = parseInt(v*255);
new Ajax.Updater('response','udmx.php?start_channel=0&value[]='+v)
}
});
</script>
Leave a comment | RSS | TrackBack
[…] the uDMX from MIDI uDMX 1.2 released !! Buy a fully assembled uDMX Stay informed: Subscribe to the uDMX mailing list Article: Control uDMXfrom a web browser […]
Pingback par [ a n y m a ] - uDMX 1.2 released — 2007-04-01 @ 2.01 pm
…heyaa there,
found you on the way seeking around to control my LEDs by PC *overtheweb*. great work, swiss made as well!! ;-) will have an eye on you…!
Commentaire par hoewe — 2007-09-11 @ 11.40 am