Browse Source

route update et nettoyage code

master
Kalyax 2 years ago
parent
commit
29f5a460f8
  1. 1
      .gitignore
  2. 6
      api/get_light.php
  3. 0
      api/get_temp.php
  4. 2
      api/set_light.php
  5. 4
      scripts/get_light.sh
  6. 13
      scripts/led.sh
  7. 5
      scripts/set_light.sh
  8. 1
      scripts/toto
  9. 5
      test.php
  10. 1
      toto

1
.gitignore

@ -0,0 +1 @@
test.php

6
api/get_light.php

@ -0,0 +1,6 @@
<?php
$light = $_GET["light"];
$output = null;
exec('bash ../scripts/get_light.sh '.$light, $output);
var_dump($output);
?>

0
api/temp.php → api/get_temp.php

2
api/set_light.php

@ -1,6 +1,6 @@
<?php <?php
$light = $_POST["light"]; $light = $_POST["light"];
$output = null; $output = null;
exec('bash ../scripts/led.sh '.$light, $output); exec('bash ../scripts/set_light.sh '.$light, $output);
var_dump($output); var_dump($output);
?> ?>

4
scripts/get_light.sh

@ -0,0 +1,4 @@
#!/bin/bash
gpio mode $1 out
let "out=`gpio read $1`"
echo $out

13
scripts/led.sh

@ -1,13 +0,0 @@
#!/bin/bash
echo $1
gpio mode $1 out
let "out=`gpio read $1`"
echo $out
if [ $out = 1 ]
then
gpio write $1 0
echo 0
else
gpio write $1 1
echo 1
fi

5
scripts/set_light.sh

@ -0,0 +1,5 @@
#!/bin/bash
gpio mode $1 out
let "out=`gpio read $1`"
gpio write $1 $out
echo $out

1
scripts/toto

@ -1 +0,0 @@
0

5
test.php

@ -1,5 +0,0 @@
<?php
$out = null;
exec("scripts/get_temp.sh", $out);
var_dump($out);
?>

1
toto

@ -1 +0,0 @@
0
Loading…
Cancel
Save