Hi, does anybody know how to check the state of a pin from a php webpage ?
I Have created a on/off led example running from a php page, but when i fire up the page i would like to know in which state a port is …
Thanks
Hi, does anybody know how to check the state of a pin from a php webpage ?
I Have created a on/off led example running from a php page, but when i fire up the page i would like to know in which state a port is …
Thanks
Could you share your code? Not because I know the answer to your question, but because I am trying to do the same thing.
1/ add node http in
2/ code for the imp ( led connected to pin9 )
// LED output example
// Configure an input to the imp from the planner
class input extends InputPort {
type=“number”;
name=“output”;
function set(s) {
// Write the pin and show the change on the planner
hardware.pin9.write(s?0:1);
server.show(s?"On":"Off");
server.log(s?"On":"Off");
}
}
// Configure pin1 as an output
hardware.pin9.configure(DIGITAL_OUT);
// Configure ourselves with the one input
imp.configure(“Output”, [input()], []);
for php code see attached file…
have fun…
This is, unfortunately, one of those things that is very simple to do with agents, but very difficult without.