From acbe90cdee6a548ec496febaad713e2b0587b485 Mon Sep 17 00:00:00 2001 From: "barraux.a" Date: Wed, 9 Nov 2022 14:54:19 +0100 Subject: [PATCH] 3.1415926535 --- api/set_light.php | 7 ++++--- api/temp.php | 4 ++-- scripts/get_temp.sh | 5 ++--- scripts/led.sh | 3 ++- scripts/toto | 1 + start_dev.sh | 0 test.php | 5 +++++ toto | 1 + 8 files changed, 17 insertions(+), 9 deletions(-) mode change 100644 => 100755 api/temp.php create mode 100644 scripts/toto mode change 100644 => 100755 start_dev.sh create mode 100644 test.php create mode 100644 toto diff --git a/api/set_light.php b/api/set_light.php index 428905f..77df9b2 100644 --- a/api/set_light.php +++ b/api/set_light.php @@ -1,5 +1,6 @@ \ No newline at end of file +$output = null; +exec('bash ../scripts/led.sh '.$light, $output); +var_dump($output); +?> diff --git a/api/temp.php b/api/temp.php old mode 100644 new mode 100755 index 4c97ee4..4cfdca3 --- a/api/temp.php +++ b/api/temp.php @@ -1,4 +1,4 @@ \ No newline at end of file +?> diff --git a/scripts/get_temp.sh b/scripts/get_temp.sh index 92747a3..7a36491 100755 --- a/scripts/get_temp.sh +++ b/scripts/get_temp.sh @@ -1,6 +1,6 @@ #!/bin/bash -response=`i2cget -y 1 0x18 0x05 w` +response=`/usr/sbin/i2cget -y 1 0x18 0x05 w` upper_byte=$(($response & 0x00FF)) lower_byte=$(($response & 0xFF00)) let "sign=0" @@ -13,5 +13,4 @@ else upper_byte=$((upper_byte & 0x0F)) let "temperature = ($upper_byte*100 * 16 + $lower_byte*100 / 4096)" fi -# printf %.2f "$(($temperature))e-2" -echo $temperature > toto; +printf %.2f "$(($temperature))e-2" diff --git a/scripts/led.sh b/scripts/led.sh index b1dc3c8..6449958 100755 --- a/scripts/led.sh +++ b/scripts/led.sh @@ -1,7 +1,8 @@ #!/bin/bash - +echo $1 gpio mode $1 out let "out=`gpio read $1`" +echo $out if [ $out = 1 ] then gpio write $1 0 diff --git a/scripts/toto b/scripts/toto new file mode 100644 index 0000000..573541a --- /dev/null +++ b/scripts/toto @@ -0,0 +1 @@ +0 diff --git a/start_dev.sh b/start_dev.sh old mode 100644 new mode 100755 diff --git a/test.php b/test.php new file mode 100644 index 0000000..61147d4 --- /dev/null +++ b/test.php @@ -0,0 +1,5 @@ + diff --git a/toto b/toto new file mode 100644 index 0000000..573541a --- /dev/null +++ b/toto @@ -0,0 +1 @@ +0