Close

Reliable operation

A project log for Electric Water Heater controler

To Control an electric water heater to only use the surplus power from my 3KW PV array

saabmanSaabman 05/15/2016 at 23:160 Comments

I had been struggling with apparent hanging of the Nodemcu.

After watch its operation closely I noticed it was always hanging in the same point in the code - just after it requested to read the energy meter - there was a time out in the code which used the value of millis added 5000 to it and if the current value of millis was greater than the calculated value then drop out of the loop and try again.

Well millis is an unsigned long integer and I was trying to compare it to an int - oops

Changed my variable to a long integer and presto no more hanging has worked consistently for days now.

Discussions