Hallo,
ich hab mir eine Datei (gpio.php) erstellt und in meinem fall den gpio 21 über ein Webinterface zu steuern.
[code=php]<html>
<head>
<meta name="viewport" content="width=device-width" />
<titel>GPIO ueber PHP schalten</titel>
</head>
GPIO 21 schalten:
<form method="get" action="gpio.php">
<input type="submit" value="LED ein" name="LEDein">
<input type="submit" value="LED aus" name="LEDaus">
</form>
<?php
$modeon21 = trim(@shell_exec("/usr/local/bin/gpio -g mode 21 out"));
if(isset($_GET['LEDein'])){
$val = trim(@shell_exec("/usr/local/bin/gpio -g write 21 1"));
echo "licht ist an";
}
else if(isset($_GET['LEDaus'])){
trim(@shell_exec("/usr/local/bin/gpio -g write 21 0"));
echo "licht ist aus";
}
?>
</body>
</html>
[/php]
Das funktioniert auch.
Jetzt hab ich mir gedacht, das auch das ganze in html geht
[code=php]<html>
<head>
<meta name="viewport" content="width=device-width" />
<titel>GPIO ueber PHP schalten</titel>
</head>
GPIO 21 schalten:
<form method="get" action="gpio.html">
<input type="submit" value="LED ein" name="LEDein">
<input type="submit" value="LED aus" name="LEDaus">
</form>
<?html
$modeon21 = trim(@shell_exec("/usr/local/bin/gpio -g mode 21 out"));
if(isset($_GET['LEDein'])){
$val = trim(@shell_exec("/usr/local/bin/gpio -g write 21 1"));
echo "licht ist an";
}
else if(isset($_GET['LEDaus'])){
trim(@shell_exec("/usr/local/bin/gpio -g write 21 0"));
echo "licht ist aus";
}
?>
</body>
</html>
[/php]
Aber das funktioniert nicht…
Meine eigentliche Frage ist… wo ist der Fehler in der html Datei ?
Grüsse
Rubi