Skip to content

Commit

Permalink
gpio stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien Bron authored and Bastien Bron committed Sep 19, 2023
1 parent f43dd3e commit cd08e5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
7 changes: 4 additions & 3 deletions borne/gpio.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
// Retrieve pin 17 and configure it as an output pin
$pin = $gpio->getOutputPin(17);

if(isset($_GET['gpio']) && $_GET['gpio']=="on"){

function ledsON(){
// Set the value of the pin high (turn it on)
$pin->setValue(PinInterface::VALUE_HIGH);
}else{
}

function ledsOFF(){
// Set the value of the pin high (turn it on)
$pin->setValue(PinInterface::VALUE_LOW);
}
9 changes: 4 additions & 5 deletions borne/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
require_once 'autoloader.php';
use Classes\Tube;

ledsOFF();

if(!$_GET['init']){
session_destroy();
header("location:interface/init.php");
}else{

// Set the value of the pin high (turn it on)
$pin->setValue(PinInterface::VALUE_HIGH);
ledsON();

$tube = new Tube();

Expand All @@ -34,8 +34,7 @@

include_once('create_tube.php');

// Set the value of the pin high (turn it on)
$pin->setValue(PinInterface::VALUE_LOW);
ledsOFF();

}
?>

0 comments on commit cd08e5b

Please sign in to comment.