Mehrere Ausgänge zugleich in PHP schalten

Hallo!

Wie kann ich mehrere Ausgänge zugleich ein oder ausschalten?
Dies ist der PHP Code

<h1>Test</h1>
<?php

$arduino_ip="10.0.0.29";
$arduino_port="80";

function arduino_send($ip,$port,$command) {
    $res = fsockopen($ip,$port);
    if($res) {
        fwrite($res,$command);
        $ret =fread($res,1);
        echo "arduino_send() returned = $ret 
\n";
        return $ret;
    } else {
        echo "Fehler, Kommando konnte nicht abgesetzt werden";
    }
}

if(isset($_GET['led1'])) {
    $led1 = $_GET['led1'];
    arduino_send($arduino_ip,$arduino_port,"S".chr(9).chr($led1));
} else {
    $led1 = arduino_send($arduino_ip,$arduino_port,"R".chr(9).chr(0));
}

if(isset($_GET['led2'])) {
    $led2 = $_GET['led2'];
    arduino_send($arduino_ip,$arduino_port,"S".chr(4).chr($led2));
} else {
    $led2 = arduino_send($arduino_ip,$arduino_port,"R".chr(4).chr(0));
}

if(isset($_GET['led3'])) {
    $led3 = $_GET['led3'];
    arduino_send($arduino_ip,$arduino_port,"S".chr(5).chr($led3));
} else {
    $led3 = arduino_send($arduino_ip,$arduino_port,"R".chr(5).chr(0));
}

?>
<form action="">
  <p>
    LED 1 : <input type="radio" name="led1" value="0" <?php if($led1==0) echo "checked" ?> >aus -  <input type="radio" name="led1" value="1" <?php if($led1==1) echo "checked" ?> >an

    LED 2 : <input type="radio" name="led2" value="0" <?php if($led2==0) echo "checked" ?> >aus -  <input type="radio" name="led2" value="1" <?php if($led2==1) echo "checked" ?> >an

    LED 3 : <input type="radio" name="led3" value="0" <?php if($led3==0) echo "checked" ?> >aus -  <input type="radio" name="led3" value="1" <?php if($led3==1) echo "checked" ?> >an

  </p>
  <input type="submit" name="submit" value="Abschicken">
</form>

Habe dies bereits in einem anderen Thread gepostet.... Dieser war leider im nachhinein gesehen schon etwas älter.

Mfg
Gotte

Du kanst die Nummer des Pins und den Status senden oder Du kannst die Statusse aller Pins (posrts) schicken. Das sind beim Arduino UNO 20 Bits oder fast 3 Bytes.
Grüße Uwe

Wo finde ich denn den Arduino Sketch dazu?

Siehe: Beispiel: WebClient.