- Fri Jun 03, 2016 4:53 pm
#48534
I have been playing with the Thermostat and having fun wiring up the hardware. The program works well.
I am trying to do a few things but cant seem to figure out the the syntax and there seems to be no examples around.
I have tried all kinds of combinations but either it does not work or I get syntax error.
1. I would like to put the
set temperature inside an html box / or table with the box color being green and the font to be larger.
2. Also am trying to put the actual temperature readout in there own colored box / table with a larger font.
3. Change the background color of the web server
I am sure there are others who like to do the same, and once we have a working example -- it can be used for other similar projects.
SCREEN SHOT- Attached
-------------------------------------------------------------------------------------------------------------------------
memclear
SERIALPRINTLN "restart page"
cls
ip()
let tf = 0
let curr = 0
let setp = 31
let stat = On
wprint "<head>"
wprint "<meta http-equiv='refresh'content='10;URL=/input?'>"
wprint "</head>"
wprint "<table bgcolor='lightblue' border='1' cellpadding='5'>"
wprint "<th><h1>WiFi Sensor + Thermostat</h1></th>"
wprint "<th</th></table><br>"
wprint "<div><table bgcolor='Yellow' border='1' cellpadding='5'>"
wprint "<tr><th>Sensor</th><th>TempC</th><th>TempF</th></tr>"
wprint "<tr><td>DS18B20P</td>"
wprint "<td bgcolor='cyan'></td>"
'wprint htmlvar(curr) & "</td>" --- code i have tried but dont work
wprint "<td bgcolor='lightgreen'></td>" -- --- works
'wprint htmlvar(tf) & "</td></tr>" - -- code does not appear inside the light green box
'wprint "<tr><td>DS18B20P</td><td bgcolor='cyan'>htmlvar(curr) & "</td>"<td bgcolor='lightgreen'>wprint htmlvar(tf) & "</td>"</tr>" - ---- another test -
print
Button "Set Temperature" [setpt]
textbox setp
wprint "<br><br>"
wprint "Current Temp - Celsius= "
wprint htmlvar(curr)
wprint "<br><br>"
wprint "Current Temp - Fahrenheit= "
wprint htmlvar(tf)
wprint "<br><br><br><br>"
wprint "COOLING FAN="
wprint htmlvar(stat)
wprint "<br><br><br>"
Button "Exit" [quit]
wprint "<br>"
timer 4000, [refresh]
wprint "<br>"
wait
[on2]
po D2 1
SERIALPRINTLN "GPIO 2 ON"
let stat = "On"
Wait
[off2]
po D2 0
SERIALPRINTLN "GPIO 2 OFF"
let stat = "Off"
Wait
[setpt]
wprint "<head>"
wprint "<meta http-equiv='refresh' content='10;URL=/input?'>"
wprint "</head>"
Wait
[refresh]
temp 0 curr ' read current temperature for device 0 db1820
tf = curr * 9
tf = tf / 5
tf = tf + 32
SERIALPRINTLN curr
SERIALPRINTLN tf
if curr > setp then goto [on2] else goto [off2] 'TURN FAN ON IF CURRENT TEMP IS GREATER THEN SETP
Wait
[quit]
timer 0
wprint "<a href='/'>Menu</a>"
end
I would very much appreciate if someone would help with coding.
Thanks
Joe
You do not have the required permissions to view the files attached to this post.