To Disable timer:
timer 0
Moderator: Mmiscool
The timer is a good point.
If I point the button to the sub routine which turns on the output device, and add the timer 0, the output does stay on or off by the buttons.
But now it wont allow me to return to normal auto operations where it uses the set temperature to control off or on.
I tried adding timer 4000 in several locations but never solved the problem.
joe
Joeman, if I was you I would set some sort of flag for manual control. let flag = 1 when you press the manual on button, and then test for the flag in the on and off routine. Because now if you turn it on, but the temp is still above the setpoint, it will try to turn off during the next refresh. So you test whether or not flag = 1 before you turn the pin off again. If flag = 1 keep pin on. I hope that makes sense.
memclear
SERIALPRINTLN "restart page"
cls
let curr = 0
let setp = 30
let stat = On
Print "ESP8266 WiFi Thermostat "
print
Button "Setpoint", [setpt]
textbox setp
wprint "<br>"
wprint "CurrTemp="
wprint htmlvar(curr)
wprint "<br>"
wprint "Heater="
wprint htmlvar(stat)
wprint "<br>"
button "Exit", [quit]
timer 4000, [refresh]
wait
[on2]
io(po,16,1)
SERIALPRINTLN "PIN 2 ON"
let stat = "On"
returngui
Wait
[off2]
io(po,16,0)
SERIALPRINTLN "PIN 2 OFF"
let stat = "Off"
returngui
Wait
[setpt]
returngui
Wait
[refresh]
curr = temp(0)
SERIALPRINTLN curr
if curr < setp then goto [on2] else goto [off2]
Wait
[quit]
timer 0
wprint "<a href='/'>Menu</a>"
end