I have tried using a while loop to create an electronic interlock, so that when i press a button on the the webserver, it will prevent a light being switched on. This light will be controlled via another button but wont be able to function until the interlock is disabled.
So essentially i want the relay controlling the light to be set to LOW while the 'isolate' button is HIGH, and i want it to stay LOW until the 'isolate' is set to LOW via another button press. This will then allow separate buttons to switch the relay HIGH and LOW.
if (digitalRead(HighLevelSwitch)) // reads HighFloatFail
{
client.print("<td> fail </td>"); // prints to webserver that float has failed
}
else
{
client.print("<td> functional </td>"); // prints to webserver that float is functional
}
How do u expect this to work without any comparison?
You are reading the switch, but you still need to compare it to some value to determine it has failed.
Something like this....
This line works fine. Without the comparison you are just testing that the value returned from digitalRead is not 0. Some argue that this is abuse of the API. Let's not hash that out again. But from a "does it work" standpoint this is fine.
I think Mr. Gammon was the one who had the best argument here. If you feel you need to compare then why not all the way out?
if ((digitalRead(HighLevelSwitch) == HIGH) == true)