komme nicht mehr weiter.
ich habe auf meiner RaspberryPI XBIAN installiert, dazu nach dieser Anleitung
http://kampis-elektroecke.de/?page_id=1626
einen Webserver
und dann nach dem http://kampis-elektroecke.de/?page_id=1659 die gpio's dann ne PhP seite gemacht die die GPIO's schaltet
PHP
<html>
<head>
<title>
Mediacenter
</title>
</head>
<div align="center">
<h1>
<font color="red">
Mediacenter
</font>
</h1>
<body>
<?php
if (isset($_REQUEST['fernseher']))
{
$val_gpio = trim(@shell_exec("cat /sys/class/gpio/gpio4/value"));
if ($val_gpio == 0)
{shell_exec("echo \"1\" > /sys/class/gpio/gpio4/value");}
elseif ($val_gpio == 1)
{shell_exec("echo \"0\" > /sys/class/gpio/gpio4/value");}
}
if (isset($_REQUEST['sat']))
{
$val_gpio = trim(@shell_exec("cat /sys/class/gpio/gpio17/value"));
if ($val_gpio == 0)
{
shell_exec("echo \"1\" > /sys/class/gpio/gpio17/value");
}
elseif ($val_gpio == 1)
{
shell_exec("echo \"0\" > /sys/class/gpio/gpio17/value");
}
}
if (isset($_REQUEST['hifi']))
{
$val_gpio = trim(@shell_exec("cat /sys/class/gpio/gpio18/value"));
if ($val_gpio == 0)
{
shell_exec("echo \"1\" > /sys/class/gpio/gpio18/value");
}
elseif ($val_gpio == 1)
{
shell_exec("echo \"0\" > /sys/class/gpio/gpio18/value");
}
}
if (isset($_REQUEST['res1']))
{
$val_gpio = trim(@shell_exec("cat /sys/class/gpio/gpio21/value"));
if ($val_gpio == 0)
{
shell_exec("echo \"1\" > /sys/class/gpio/gpio21/value");
}
elseif ($val_gpio == 1)
{
shell_exec("echo \"0\" > /sys/class/gpio/gpio21/value");
}
}
if (isset($_REQUEST['res2']))
{
$val_gpio = trim(@shell_exec("cat /sys/class/gpio/gpio22/value"));
if ($val_gpio == 0)
{
shell_exec("echo \"1\" > /sys/class/gpio/gpio22/value");
}
elseif ($val_gpio == 1)
{
shell_exec("echo \"0\" > /sys/class/gpio/gpio22/value");
}
}
if (isset($_REQUEST['res3']))
{
$val_gpio = trim(@shell_exec("cat /sys/class/gpio/gpio24/value"));
if ($val_gpio == 0)
{
shell_exec("echo \"1\" > /sys/class/gpio/gpio24/value");
}
elseif ($val_gpio == 1)
{
shell_exec("echo \"0\" > /sys/class/gpio/gpio24/value");
}
}
if (isset($_REQUEST['res4']))
{
$val_gpio = trim(@shell_exec("cat /sys/class/gpio/gpio23/value"));
if ($val_gpio == 0)
{
shell_exec("echo \"1\" > /sys/class/gpio/gpio23/value");
}
elseif ($val_gpio == 1)
{
shell_exec("echo \"0\" > /sys/class/gpio/gpio23/value");
}
}
if (isset($_REQUEST['res5']))
{
$val_gpio = trim(@shell_exec("cat /sys/class/gpio/gpio25/value"));
if ($val_gpio == 0)
{
shell_exec("echo \"1\" > /sys/class/gpio/gpio25/value");
}
elseif ($val_gpio == 1)
{
shell_exec("echo \"0\" > /sys/class/gpio/gpio25/value");
}
}
if (isset($_REQUEST['irtv']))
{
echo "<script type='text/javascript'>document.location='irtv.php';</script>'";
}
if (isset($_REQUEST['irsat']))
{
echo "<script type='text/javascript'>document.location='irsat.php';</script>'";
}
if (isset($_REQUEST['irhifi']))
{
echo "<script type='text/javascript'>document.location='irhifi.php';</script>'";
}
if (isset($_REQUEST['irdvd']))
{
echo "<script type='text/javascript'>document.location='irdvd.php';</script>'";
}
if (isset($_REQUEST['aus']))
{
shell_exec("echo \"0\" > /sys/class/gpio/gpio4/value");
shell_exec("echo \"0\" > /sys/class/gpio/gpio17/value");
shell_exec("echo \"0\" > /sys/class/gpio/gpio18/value");
shell_exec("echo \"0\" > /sys/class/gpio/gpio21/value");
shell_exec("echo \"0\" > /sys/class/gpio/gpio22/value");
shell_exec("echo \"0\" > /sys/class/gpio/gpio23/value");
shell_exec("echo \"0\" > /sys/class/gpio/gpio24/value");
shell_exec("echo \"0\" > /sys/class/gpio/gpio25/value");
}
$val_gpio1 = trim(@shell_exec("cat /sys/class/gpio/gpio4/value"));
$val_gpio2 = trim(@shell_exec("cat /sys/class/gpio/gpio17/value"));
$val_gpio3 = trim(@shell_exec("cat /sys/class/gpio/gpio18/value"));
$val_gpio4 = trim(@shell_exec("cat /sys/class/gpio/gpio21/value"));
$val_gpio5 = trim(@shell_exec("cat /sys/class/gpio/gpio22/value"));
$val_gpio6 = trim(@shell_exec("cat /sys/class/gpio/gpio23/value"));
$val_gpio7 = trim(@shell_exec("cat /sys/class/gpio/gpio24/value"));
if ($val_gpio1 == 0)
{$idfernseher = '#ff0000';}
elseif ($val_gpio1 == 1)
{$idfernseher = '#00ff00';}
if ($val_gpio2 == 0)
{$idsat = '#ff0000';}
elseif ($val_gpio2 == 1)
{$idsat = '#00ff00';}
if ($val_gpio3 == 0)
{$idhifi = '#ff0000';}
elseif ($val_gpio3 == 1)
{$idhifi = '#00ff00';}
if ($val_gpio4 == 0)
{$idres1 = '#ff0000';}
elseif ($val_gpio4 == 1)
{$idres1 = '#00ff00';}
if ($val_gpio5 == 0)
{$idres2 = '#ff0000';}
elseif ($val_gpio5 == 1)
{$idres2 = '#00ff00';}
if ($val_gpio6 == 0)
{$idres4 = '#ff0000';}
elseif ($val_gpio6 == 1)
{$idres4 = '#00ff00';}
if ($val_gpio7 == 0)
{$idres3 = '#ff0000';}
elseif ($val_gpio7 == 1)
{$idres3 = '#00ff00';}
$val_gpio = trim(@shell_exec("cat /sys/class/gpio/gpio25/value"));
if ($val_gpio == 0)
{$idres5 = '#ff0000';}
elseif ($val_gpio == 1)
{$idres5 = '#00ff00';}
if ($val_gpio1 == 0 & $val_gpio2 == 0 & $val_gpio3 == 0 & $val_gpio4 == 0 & $val_gpio5 == 0 & $val_gpio6 == 0 & $val_gpio7 == 0)
{
shell_exec("echo \"0\" > /sys/class/gpio/gpio25/value");
}
else
{
shell_exec("echo \"1\" > /sys/class/gpio/gpio25/value");
}
echo('
<form action="index.php" method ="post">
<input type="Submit" id="irtv" name="irtv" value="Fernseher" style="height: 8%; width: 19.8%; font-size: 200%;">
<input type="Submit" id="irsat" name="irsat" value="SAT" style="height: 8%; width: 19.8%; font-size: 200%;">
<input type="Submit" id="irhifi" name="irhifi" value="HiFi" style="height: 8%; width: 19.8%; font-size: 200%;">
<input type="Submit" id="irdvd" name="irdvd" value="DVD" style="height: 8%; width: 19.8%; font-size: 200%;"><br>
<p>
<input type="Submit" name="aktualisieren" value="Aktualisieren" style="height: 7,5%; width: 80%; font-size: 300%;"><br>
<p>
<input type="Submit" id="buttonfernseher" name="fernseher" value="Fernseher" style="height: 7,5%; width: 80%; font-size: 300%;"><br>
<p>
<input type="Submit" id="buttonsat" name="sat" value="SAT" style="height: 7,5%; width: 80%; font-size: 300%;"><br>
<p>
<input type="Submit" id="buttonhifi" name="hifi" value="HIFI" style="height: 7,5%; width: 80%; font-size: 300%;"><br>
<p>
<input type="Submit" id="buttonres1" name="res1" value="DVD" style="height: 7,5%; width: 80%; font-size: 300%;"><br>
<p>
<input type="Submit" id="buttonres4" name="res4" value="Reserve 2" style="height: 7,5%; width: 80%; font-size: 300%;"><br>
<p>
<input type="Submit" id="buttonres3" name="res3" value="Reserve 3" style="height: 7,5%; width: 80%; font-size: 300%;"><br>
<p>
<input type="Submit" id="buttonres2" name="res2" value="Reserve 4" style="height: 7,5%; width: 80%; font-size: 300%;"><br>
<p>
<input type="Submit" name="aus" value="Alles AUS" style="height: 7,5%; width: 80%; font-size: 300%;"><br>
</form>
');
?>
<style type="text/css">
<!--
#buttonfernseher {
background-color:<?php echo $idfernseher ?>;
}
#buttonsat {
background-color:<?php echo $idsat ?>;
}
#buttonhifi {
background-color:<?php echo $idhifi ?>;
}
#buttonres1 {
background-color:<?php echo $idres1 ?>;
}
#buttonres2 {
background-color:<?php echo $idres2 ?>;
}
#buttonres3 {
background-color:<?php echo $idres3 ?>;
}
#buttonres4 {
background-color:<?php echo $idres4 ?>;
}
#buttonres5 {
background-color:<?php echo $idres5 ?>;
}
-->
</style>
</body>
</div>
</html>
Alles anzeigen
also das funktioniert soweit.
jetzt das Problem das ich habe, ich möchte auf dem selben Webserver noch per PHP befehl Infrarotsignale senden
wenn ich die Befehle per Putty eingebe, blinkt die LED wenn ich die Befehle per PHP schicken nicht, kann mir wer sagen was ich da falsch mache?
PHP
<html>
<head>
<title>
Mediacenter
</title>
</head>
<div align="center">
<h1>
<font color="red">
Fernseher
</font>
</h1>
<body>
<form action="irtv.php" method ="post">
<input type="Submit" name="zurueck" value="Mainpage" style="height: 8%; width: 80%; font-size: 300%;"><br>
<p>
<input type="Submit" name="ok" value="OK" style="height: 8%; width: 19.8%; font-size: 300%;">
[size=12] <input type="Submit" name="menue" value="Men[/size][size=12][font="Lucida Console"][size=12][font="Lucida Console"]ü" style="height: 8%; width: 19.8%; font-size: 300%;"> [/font][/size][/font][/size]
<input type="Submit" name="input" value="Inp." style="height: 8%; width: 19.8%; font-size: 300%;">
<input type="Submit" name="power" value="Pow." style="height: 8%; width: 19.8%; font-size: 300%; background-color:red;">
<br><p>
<input type="Submit" name="eins" value="1" style="height: 8%; width: 26.4%; font-size: 300%;">
<input type="Submit" name="zwei" value="2" style="height: 8%; width: 26.4%; font-size: 300%;">
<input type="Submit" name="drei" value="3" style="height: 8%; width: 26.4%; font-size: 300%;">
<br><p>
<input type="Submit" name="vier" value="4" style="height: 8%; width: 26.4%; font-size: 300%;">
<input type="Submit" name="fuenf" value="5" style="height: 8%; width: 26.4%; font-size: 300%;">
<input type="Submit" name="sechs" value="6" style="height: 8%; width: 26.4%; font-size: 300%;">
<br><p>
<input type="Submit" name="sieben" value="7" style="height: 8%; width: 26.4%; font-size: 300%;">
<input type="Submit" name="acht" value="8" style="height: 8%; width: 26.4%; font-size: 300%;">
<input type="Submit" name="neun" value="9" style="height: 8%; width: 26.4%; font-size: 300%;">
<br><p>
<input type="Submit" name="kanalplus" value="P+" style="height: 8%; width: 26.4%; font-size: 300%;">
<input type="Submit" name="null" value="0" style="height: 8%; width: 26.4%; font-size: 300%;">
<input type="Submit" name="volumeplus" value="Vol+" style="height: 8%; width: 26.4%; font-size: 300%;">
<br><p>
<input type="Submit" name="kanalminus" value="P-" style="height: 8%; width: 26.4%; font-size: 300%;">
<input type="Submit" name="mute" value="Mute" style="height: 8%; width: 26.4%; font-size: 300%;">
<input type="Submit" name="volumeminus" value="Vol-" style="height: 8%; width: 26.4%; font-size: 300%;">
<br><p><br><p>
<input type="Submit" name="guide" value="Guide" style="height: 8%; width: 26.4%; font-size: 300%;">
<input type="Submit" name="hoch" value="A" style="height: 8%; width: 26.4%; font-size: 300%;">
<input type="Submit" name="qmenue" value="Q.Men" style="height: 8%; width: 26.4%; font-size: 300%;">
<br><p>
<input type="Submit" name="links" value="<" style="height: 8%; width: 26.4%; font-size: 300%;">
<input type="Submit" name="ok" value="OK" style="height: 8%; width: 26.4%; font-size: 300%;">
<input type="Submit" name="rechts" value=">" style="height: 8%; width: 26.4%; font-size: 300%;">
<br><p>
<input type="Submit" name="back" value="BACK" style="height: 8%; width: 26.4%; font-size: 300%;">
<input type="Submit" name="runter" value="V" style="height: 8%; width: 26.4%; font-size: 300%;">
<input type="Submit" name="exit" value="EXIT" style="height: 8%; width: 26.4%; font-size: 300%;">
<br><p><br><p>
<input type="Submit" name="rot" value="" style="height: 8%; width: 19.8%; font-size: 300%; background-color:red;">
<input type="Submit" name="gruen" value="" style="height: 8%; width: 19.8%; font-size: 300%; background-color:green;">
<input type="Submit" name="gelb" value="" style="height: 8%; width: 19.8%; font-size: 300%; background-color:yellow;">
<input type="Submit" name="blau" value="" style="height: 8%; width: 19.8%; font-size: 300%; background-color:blue;">
<br><p>
</form>
<?php
if (isset($_REQUEST['eins']))
{
shell_exec("irsend SEND_ONCE fernseher 1");
}
if (isset($_REQUEST['zwei']))
{
shell_exec("irsend SEND_ONCE fernseher 2");
}
if (isset($_REQUEST['drei']))
{
shell_exec("irsend SEND_ONCE fernseher 3");
}
if (isset($_REQUEST['vier']))
{
shell_exec("irsend SEND_ONCE fernseher 4");
}
if (isset($_REQUEST['fuenf']))
{
shell_exec("irsend SEND_ONCE fernseher 5");
}
if (isset($_REQUEST['sechs']))
{
shell_exec("irsend SEND_ONCE fernseher 6");
}
if (isset($_REQUEST['sieben']))
{
shell_exec("irsend SEND_ONCE fernseher 7");
}
if (isset($_REQUEST['acht']))
{
shell_exec("irsend SEND_ONCE fernseher 8");
}
if (isset($_REQUEST['null']))
{
shell_exec("irsend SEND_ONCE fernseher 0");
}
if (isset($_REQUEST['neun']))
{
shell_exec("irsend SEND_ONCE Fernseher 9");
}
if (isset($_REQUEST['ok']))
{
shell_exec("irsend SEND_ONCE Fernseher ok");
}
if (isset($_REQUEST['menue']))
{
shell_exec("irsend SEND_ONCE Fernseher menu");
}
if (isset($_REQUEST['input']))
{
shell_exec("irsend SEND_ONCE Fernseher input");
}
if (isset($_REQUEST['power']))
{
shell_exec("irsend SEND_ONCE Fernseher power");
}
if (isset($_REQUEST['kanalplus']))
{
shell_exec("irsend SEND_ONCE Fernseher ch_up");
}
if (isset($_REQUEST['volumeplus']))
{
shell_exec("irsend SEND_ONCE Fernseher KEY_VOLUMEUP");
}
if (isset($_REQUEST['kanalminus']))
{
shell_exec("irsend SEND_ONCE Fernseher ch_down");
}
if (isset($_REQUEST['mute']))
{
shell_exec("irsend SEND_ONCE Fernseher mute");
}
if (isset($_REQUEST['volumeminus']))
{
shell_exec("irsend SEND_ONCE Fernseher KEY_VOLUMEDOWN");
}
if (isset($_REQUEST['guide']))
{
shell_exec("irsend SEND_ONCE Fernseher guide");
}
if (isset($_REQUEST['hoch']))
{
shell_exec("irsend SEND_ONCE Fernseher up");
}
if (isset($_REQUEST['qmenue']))
{
shell_exec("irsend SEND_ONCE Fernseher q.menu");
}
if (isset($_REQUEST['links']))
{
shell_exec("irsend SEND_ONCE Fernseher left");
}
if (isset($_REQUEST['ok']))
{
shell_exec("irsend SEND_ONCE Fernseher ok");
}
if (isset($_REQUEST['rechts']))
{
shell_exec("irsend SEND_ONCE Fernseher right");
}
if (isset($_REQUEST['back']))
{
shell_exec("irsend SEND_ONCE Fernseher back");
}
if (isset($_REQUEST['runter']))
{
shell_exec("irsend SEND_ONCE Fernseher down");
}
if (isset($_REQUEST['exit']))
{
shell_exec("irsend SEND_ONCE Fernseher exit");
}
if (isset($_REQUEST['rot']))
{
shell_exec("irsend SEND_ONCE Fernseher red");
}
if (isset($_REQUEST['gruen']))
{
shell_exec("irsend SEND_ONCE Fernseher green");
}
if (isset($_REQUEST['gelb']))
{
shell_exec("irsend SEND_ONCE Fernseher ellow");
}
if (isset($_REQUEST['blau']))
{
shell_exec("irsend SEND_ONCE Fernseher blue");
}
if (isset($_REQUEST['']))
{
shell_exec("irsend SEND_ONCE Fernseher ");
}
if (isset($_REQUEST['zurueck']))
{
echo "<script type='text/javascript'>document.location='index.php';</script>'";
}
?>
</body>
</div>
</html>
Alles anzeigen