Bonjour, j’aimerai connaitre la valeur d’une gpio sur ma page html et en changer l’etat d’un bouton, quelqu’un peut m’aider sachant que j’ai trouvé ça en creusant:
html>
<head>
</head>
<body>
<form name="theform" method="post" action="<?php print($_SERVER['PHP_SELF']); ?>">
<?php
//$status1 = trim(shell_exec("gpio -g read 23"));
$status="1";
if(isset($_POST['turnon'])){
// this is where you call your python or whatever when the status is already 1
$status="0";
}
if(isset($_POST['turnoff'])){
// this is where you call your python or whatever when status is already 0
$status="1";
}
if ($status==="1") {
echo "<input name=\"turnon\" type=\"submit\" style=\"background-color:#FF0000; width: 400px; height:350px; font-size:60px;\" value=\"Turn Relay 1 on\">";
} else {
echo "<input name=\"turnoff\" type=\"submit\" style=\"background-color:#009900; width: 400px; height:350px; font-size:60px;\" value=\"Turn Relay 1 off\">";
}
?>
</form>
<br>
<br>
<?php echo date('Y-m-d H:i:s');
?>
</body>
</html>
merci