- Thu Nov 26, 2015 2:01 pm
#35091
here is the thermostat program updated to work on the esp8266-01 module
with the ds18b20 connected to GPIO 0 and an LED connected between GPIO 2 and GND
I have also added a conversion from C to F and it displays both.
feel free to use the updated code in place of the WiFi Thermostat code in the examples
dwight
Code: Select allmemclear
SERIALPRINTLN "restart page"
cls
let tf = 0
let curr = 0
let setp = 30
let stat = On
wprint "<head>"
wprint "<meta http-equiv='refresh' content='5;URL=/input?'>"
wprint "</head>"
Print "ESP8266 WiFi Thermostat "
print
Button "Setpoint" [setpt]
textbox setp
wprint "<br><br>"
wprint "Celsius= "
wprint htmlvar(curr)
wprint "<br>"
wprint "Fahrenheit= "
wprint htmlvar(tf)
wprint "<br>"
wprint "Pin 0="
wprint htmlvar(stat)
wprint "<br><br>"
button "Exit" [quit]
timer 4000 [refresh]
wait
[on2]
po 0 1
SERIALPRINTLN "PIN 0 On"
let stat = "On"
Wait
[off2]
po 0 0
SERIALPRINTLN "PIN 0 Off"
let stat = "Off"
Wait
[setpt]
wprint "<head>"
wprint "<meta http-equiv='refresh' content='5;URL=/input?'>"
wprint "</head>"
Wait
[refresh]
temp 0 curr
tf = curr * 9
tf = tf / 5
tf = tf + 32
SERIALPRINTLN curr
SERIALPRINTLN tf
if curr < setp then goto [on2] else goto [off2]
Wait
[quit]
timer 0
wprint "<a href='/'>Menu</a>"
end