I need to ask here in the condition of the digital output is already set to high. It is perhaps this design?
.....
digitalWrite (2, HIGH);
if (digitalWrite (2) == LOW) {client.print ("OFF");} else {clint.print ("ON";}
....
Is it fair condition digitalWrite (2) == LOW or need to ask me otherwise? thank you
I have a handy little Output class that wraps the digital IO in some useful functions. It also keeps track of the current state of the output pin, and allows callbacks when a pin changes state.