3 EIBD client library examples
4 Copyright (C) 2005-2011 Martin Koegler <mkoegler@auto.tuwien.ac.at>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 include ("common.php");
23 html_header($config->title
);
25 if ($_GET["addr"] != "" && $_GET["val"] != "" )
27 $addr = $_GET["addr"];
29 $value = $_GET["val"];
32 $con = $config->connect ();
37 $res=groupswrite ($con, $addr, $value);
45 $value = (int)(($value * 255) / 100 +
0.5);
46 $res=groupwrite ($con, $addr, array ($value & 0xff));
50 $res=groupwrite ($con, $addr, array ($value & 0xff));
54 $res=groupwrite ($con, $addr, array (($value >> 8) & 0xff, $value & 0xff));
58 $res=groupwrite ($con, $addr, f2_encode($value));
63 printf("<div class='result'>sending of %s to %s failed</div>", htmlentities($value), htmlentities($addr));
65 printf("<div class='result'>sent %s to %s </div>", htmlentities($value), htmlentities($addr));