if (state != lstate)
Personally I would change this to
if (state != lstate && state == HIGH)
to avoid the need to divide the frequency by 2 later.
Does the reading go in the correct direction if you change the humidity ?
if (state != lstate)
Personally I would change this to
if (state != lstate && state == HIGH)
to avoid the need to divide the frequency by 2 later.
Does the reading go in the correct direction if you change the humidity ?