-Installer Rasbian OS
-Chemin d'accès vers le dossier où mettre tous les fichiers qui vont suivre : /var/www/html
attention: n'oubliez pas les chevrons que je ne peux pas mettre en description .... je ne sais pas pourquoi .
-contenu du fichier index.php:
!doctype html
html lang="fr"
head
meta charset="utf-8"
title Contrôle GPIO /title
link rel="stylesheet" type="text/css" href="stylesheet.css"
/head
body
form action="script.php" method="post"
input type="submit" name="serveur" value="serveur" class="button" id="ON"
input type="submit" name="prise" value="prise" class="button" id="ON"
input type="submit" name="none1" value="none1" class="button" id="ON"
input type="submit" name="none2" value="none2" class="button" id="ON"
br/
input type="submit" name="serveur" value="OFF" class="button" id="OFF"
input type="submit" name="prise" value="OFF" class="button" id="OFF"
input type="submit" name="none1" value="OFF" class="button" id="OFF"
input type="submit" name="none2" value="OFF" class="button" id="OFF"
br/
/form
/body
/html
-contenu du fichier script.php:
?php
system("gpio -g mode 4 out");
system("gpio -g mode 17 out");
system("gpio -g mode 22 out");
system("gpio -g mode 27 out");
if($_POST['serveur'] == 'serveur')
{
system("gpio -g write 4 0");
}
if($_POST['serveur'] == 'OFF')
{
system("gpio -g write 4 1");
}
if($_POST['prise'] == 'prise')
{
system("gpio -g write 17 0");
}
if($_POST['prise'] == 'OFF')
{
system("gpio -g write 17 1");
}
if($_POST['none1'] == 'none1')
{
system("gpio -g write 27 0");
}
if($_POST['none1'] == 'OFF')
{
system("gpio -g write 27 1");
}
if($_POST['none2'] == 'none2')
{
system("gpio -g write 22 0");
}
if($_POST['none2'] == 'OFF')
{
system("gpio -g write 22 1");
}
header('Location: index.php');
?
-contenu du fichier stylesheet.css :
html, body
{
margin: 0;
}
.button
{
border: none;
color: white;
text-align: center;
font-size: 3.5em;
padding: 25px 25px;
cursor: pointer;
width: 24%;
height: 50vh;
}
#ON
{
background-color: green;
}
#OFF
{
background-color: red;
}
...
https://www.youtube.com/watch?v=mcNr1_DoGJ8