DS18B20 Wifi Thermostat (3.0 branch only)
memclear
SERIALPRINTLN "restart page" cls let curr = 0 let setp = 30 let stat = On Print "ESP8266 WiFi Thermostat " Button "Setpoint", [refresh] textbox setp wprint "CurrTemp=" textbox curr wprint "<br>" wprint "Heater=" textbox stat wprint "<br>" button "Exit", [quit] timer 4000, [refresh] wait [on2] io(po,2,0) SERIALPRINTLN "PIN 2 ON" let stat = "On" Wait [off2] io(po,2,1) SERIALPRINTLN "PIN 2 OFF" let stat = "Off" 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 |
This example was contributed by Rotohammer. Original discussion thread (http://www.esp8266.com/viewtopic.php?f=41&t=6422)
Pin 2 is connected to a relay module to turn the heater on or off. The onewire sensor must be connected to pin 2 as all onewire communication is hard coded to use this pin. |