From: Arjen Baart Date: Sun, 2 Feb 2020 13:32:49 +0000 (+0100) Subject: Simple web interface X-Git-Url: http://www.andromeda.nl/gitweb/?a=commitdiff_plain;h=91bdbe1895225802e7ee0c29f0844329c40884e9;p=wakeup.git Simple web interface --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5f70486 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +Makefile.in +.*.swp diff --git a/web/lightcontrol.js b/web/lightcontrol.js new file mode 100644 index 0000000..8d2a6f7 --- /dev/null +++ b/web/lightcontrol.js @@ -0,0 +1,39 @@ +var xmlHttp; + +function lightcontrol_callback() +{ + if (xmlHttp.readyState == 4) + { + //alert("HTTP response text " + xmlHttp.responseText.split(" ")); + lightcolors = xmlHttp.responseText.split(" "); + //alert("Red = " + lightcolors[0]); + redbox = document.getElementById("red"); + redbox.value = lightcolors[0]; + greenbox = document.getElementById("green"); + greenbox.value = lightcolors[1]; + bluebox = document.getElementById("blue"); + bluebox.value = lightcolors[2]; + whitebox = document.getElementById("white"); + whitebox.value = lightcolors[3]; + } +} + +function lightcontrol() +{ + xmlHttp.onreadystatechange=lightcontrol_callback; + xmlHttp.open("GET","lightcontrol.php",true); + xmlHttp.send(null); +} + +function _init() +{ + xmlHttp=new XMLHttpRequest(); + lightcontrol(); +} + +function change_light(color, value) +{ + xmlHttp.onreadystatechange=lightcontrol_callback; + xmlHttp.open("GET","lightcontrol.php?" + color + "=" + value, true); + xmlHttp.send(null); +} diff --git a/web/lightcontrol.php b/web/lightcontrol.php new file mode 100644 index 0000000..fd57769 --- /dev/null +++ b/web/lightcontrol.php @@ -0,0 +1,39 @@ + diff --git a/web/slider.html b/web/slider.html index d36f922..157af22 100644 --- a/web/slider.html +++ b/web/slider.html @@ -3,17 +3,29 @@ - SVG in XHTML Example + Light control + + + - -

Animation with Ecmascript

+ + +

Light control

+ +
+ Red
+ Green
+ Blue
+ White
+
+

+ xmlns:xlink="http://www.w3.org/1999/xlink" >