@Rinus-van-Weert thanks for the example.
find an small error on this line: "to the 'main' section of the /etc/config/uhhtpd file" => uhhtpd = uhttpd
@Bo Barry you can run the program in your brouwser, http:\ipadres.for.onion\php\SwithcLeds.php
(if you put the script in www/php as SwitchLeds.php)
I have also a relay expansion and make 2 functions for this:
function initRelay( ){ // init Relay expansion
$command = 'relay-exp -i';
exec( $command ); //init
}
function writeRelay( $pen, $value){
if ( is_numeric( $value) ) // check if value is a number, could also be empty, if so write value tot output pin
{ $command = 'relay-exp ' .$pen .($value == 1 ? ' 1' : ' 0');
$res = exec( $command );
echo $res;
}
return $value;
}
but there is no way to get the status of the relays. you only now the status when init.