I'm using some of the concepts here to build a similar device for a pool. The thing I'm struggling with is this bit of code you have:
void getPoolMode()
{
if (pulseIn(modeSensePin, HIGH, 3000000) > 100)
{
currentStatus = "SPA";
if(currentStatus != oldStatus)
{
client.publish("pool/mode","SPA", true);
oldStatus = currentStatus;
}
}
else if(digitalRead(modeSensePin) == HIGH)
{
currentStatus = "SPA";
if(currentStatus != oldStatus)
{
client.publish("pool/mode","SPA", true);
oldStatus = currentStatus;
}
}
else
{
currentStatus = "POOL";
if(currentStatus != oldStatus)
{
client.publish("pool/mode","POOL", true);
oldStatus = currentStatus;
}
}
}
Why are you testing if the modeSensePin is pulsing to set mode SPA if you're just also testing for digitinRead HIGH on the same pin to set the same state? This bit confuses me. Any feedback?
If you are morbidly curious, check out my code!
I'm using some of the concepts here to build a similar device for a pool. The thing I'm struggling with is this bit of code you have:
Why are you testing if the modeSensePin is pulsing to set mode SPA if you're just also testing for digitinRead HIGH on the same pin to set the same state? This bit confuses me. Any feedback?
If you are morbidly curious, check out my code!