Browse Source

ajoute un état du volet

master
BOLLET Corentin 1 year ago
parent
commit
c61b2e2a13
  1. 24
      index.php

24
index.php

@ -7,12 +7,25 @@
<link rel="stylesheet" href="styles.css">
</head>
<?php
$etat_volet = "none";
exec('gpio mode 7 out');
exec('gpio mode 0 out');
exec('gpio mode 2 out');
exec('gpio mode 3 out');
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_['ouvrir_volet'])) {
exec('gpio write 2 1');
sleep(1);
exec('gpio write 2 0');
$etat_volet = 'ouvert';
} elseif (isset($_['fermer_volet'])) {
exec('gpio write 3 1');
sleep(1);
exec('gpio write 3 0');
$etat_volet = 'fermé';
}
if (isset($_POST['lumiere'])) {
$lumiere = $_POST['lumiere'];
if ($lumiere == "Allumer") {
@ -70,8 +83,15 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
<img src="https://www.voletshop.fr/52430-large_default/Volet-roulant-renovation-manuel.jpg" alt="Volet roulant">
<div class="buttons">
<form method="post" action="">
<input type="submit" name="volet" value="Fermer" onclick="document.getElementById('chargement_fermeture_volet').style.display = 'block';document.getElementById('main').style.opacity = '0.5';">
<input type="submit" name="volet" value="Ouvrir" onclick="document.getElementById('chargement_ouverture_volet').style.display = 'block';document.getElementById('main').style.opacity = '0.5';">
<?php
if ($etat_volet === "none") {
<input type="submit" name="ouvrir_volet" value="oui" onclick="document.getElementById('chargement_fermeture_volet').style.display = 'block';document.getElementById('main').style.opacity = '0.5';">
<input type="submit" name="fermer_volet" value="oui" onclick="document.getElementById('chargement_ouverture_volet').style.display = 'block';document.getElementById('main').style.opacity = '0.5';">
} elseif ($etat_volet === "ouvert") {
<input type="submit" name="fermer_volet" value="oui" onclick="document.getElementById('chargement_ouverture_volet').style.display = 'block';document.getElementById('main').style.opacity = '0.5';">
} elseif ($etat_volet === "fermé") {
<input type="submit" name="ouvrir_volet" value="oui" onclick="document.getElementById('chargement_fermeture_volet').style.display = 'block';document.getElementById('main').style.opacity = '0.5';">
}?>
</form>
</div>
</div>

Loading…
Cancel
Save