Hey guys, I was wondering what the best method was to set a digital pin as an output but still check wether it is on or off.
I’m building a web interface to control relays and for example I change the state of a pin, close the browser but when I later open the browser I want my browser to check if it is still on.
Hello, very interesting topic for me, I want to avoid to take another pin of the spark core to know the state of an Output (A3)
Can you say me what I should add to my code? I don’t understand how an output can be at the same time an input…?
So you mean I just need to add digitalRead(A3); inside the void loop, and I will be able to check the state of my output (A3) with a POST request like other input of the Core?
I want to check with a Web interface the state of the digital output (A3 in my case) when this A3 pin is set as Output in my Spark Core code.
So if I’m right I will add digitalRead(A3); in my void loop and I will make a POST request through the web to know the state of A3 output when needed? correct?
web request to know the state is very simple: https://api.spark.io/v1/devices/{{Device}}/etatchaud?access_token={{Token}}
that will return 1 if output is HIGH and 0 is output is LOW.