But, when I open the page I can't tell the current state (high or low, 0 or 1). Can someone guide me how to include a call to read and display current state of a GPIO?
Code: Select all
...
<p><form method="get" action="switch.php">
<input type="submit" value="ON" name="on">
<input type="submit" value="OFF" name="off">
</form>
<?php
$setmode17 = shell_exec("/usr/local/bin/gpio -g mode 17 out");
if(isset($_GET['on'])){
$gpio_on = shell_exec("/usr/local/bin/gpio -g write 17 1");
echo "Heater is on";
}