I have a Pi set up with Apache and wiringpi, and I would like to read the state of an in
pin (every 20 seconds, if possible) and display it on my webpage using PHP. The input is to determine if my computer is on or off remotely.
So basically, I want to store the output of a system(gpio -g read 7)
command into a variable ($status
) and then print it on the page like so:
Your computer is currently: $status.
Where $status can be either on
or off
depending on if the read
command comes back as a 1
or 0
.
I can post what code I already have, but right now it just sends a power toggle out of a GPIO out
pin.
Any help is appreciated! Thanks.