Post about your Basic project here

Moderator: Mmiscool

User avatar
By forlotto
#55066 Yes of course

thx for pointing that out was not paying close enough attention that I was pasting between quotes when I did not need the quotes.

remove the quotes on the outsides I believe from what mmiscool says like so.

Possibly this should work it may have issues I am not testing just helping solve you can test.

Code: Select all'ESPBASIC V3 A44 ECOSTATcss77 dual statmode
'DB1820S Temp Sensor Data PIN IS D4
'Pin D2 for led or relay output inside
'Pin D5 for led or relay output outside
'edited by forlotto
memclear
cls
let tf = 0
let curr = 0
let outc = 0 'for second temp sensor
let statmode = "TOOHOT"
setp = 19
settemp = 19
let stat = "ON"
let statout = "ON"
let setpout = 19

'cssclass "button", "background-color: #99e6e6;"
cssclass "align-self: center;"
css "test1.css"
wprint "<head>"
wprint "<meta http-equiv='refresh'content='5;URL=/input?'>"
wprint "</head>"
wprint "<body bgcolor='#527a7a'>"
wprint "<table align='center' width='102' bgcolor='lightblue' border='4' cellpadding='1'>"
wprint "<td>"
button "MODE", [NIL]
dropdown statmode, "TOOCOLD,TOOHOT"
cssid htmlid(), "background-color:#008ae6;text-align: center;display:block;width:105px"
wprint "<br>"
wprint "</td>"
wprint "<th</th></table><br>"

wprint "<table align='center' width='150' bgcolor='LIGHTblue' border='2' cellpadding='1'>"
wprint "<td>"
button "FAN IP 77", [NIL]
wprint "<b>"
wprint |<mark style="background-color:yellow;">|
wprint "<center>" & htmlvar(stat) & "</center>"
wprint "</mark>"
wprint "</b>"
'wprint "<br>"
wprint "</td>"
wprint "<th</th></table>"
wprint "<br>"
wprint "<table align='center' width='192' bgcolor='lightblue' border='4' cellpadding='3'>"
wprint "<td>"
wprint "  Dropdown "
dropdown setp, "15,18,19,21,22,23,25,26,27,28,30,32,35,38"
wprint "List"
Button "<B>Trigger Level</B>",[setpt]
textbox setp
cssid htmlid(), "background-color:LIGHTGREEN;text-align: center;display:block;width:170px"

wprint "<center> Current Trigger Level </center>"
wprint "<th</th></table><br>"
wprint "<br>"

wprint "<table align='center' width='200' bgcolor='LIGHTBLUE' border='2' cellpadding='2'>"
wprint "<td>"
button "TEMP-C",[NIL]
cssid htmlid(), "background-color:LIGHTGREEN;text-align: center;display:block;width:120px"

wprint "<b>"
wprint |<mark style="background-color:yellow;">|
wprint "<center>" & htmlvar(curr) & "</center>"
wprint "</mark>"
wprint "</b>"
wprint "</td>"
wprint "<td>"
wprint "<b>"
button "TEMP-F",[NIL]
cssid htmlid(), "background-color:LIGHTGREEN;text-align: center;display:block;width:120px"
wprint |<mark style="background-color:yellow;">|
wprint "<center>" & htmlvar(tfout) & "</center>"
wprint "</mark>"
wprint "</b>"
wprint "</td>"
wprint "<th</th></table><br>"

timer 4000, [refreshcold]
wait
[on2] ' FIRST SENSOR DB1820S ---------
io(po,d5,1)
let stat = "ON"
wait

[off2] ' FIRST SENSOR DB1820S ---------
io(po,d5,0)
let stat = "OFF"
wait

[setpt]
wprint "<head>"
wprint "<meta http-equiv='refresh' content='5;URL=/input?'>"
wprint "</head>"
wait
[refreshcold]

if statmode == "TOOHOT" then goto [refreshhot]
curr = temp(1) 'curr ' read current temperature for device 1 db1820 SECOND SENSOR
'outc = temp(0) ' outc ' read current temperature for device 0 db1820 FIRST SENSOR
tf = curr * 9 ' Fahrenheit CONVERSON
tf = tf / 5
tf = tf + 32
tfout = outc * 9
tfout = tfout / 5
tfout = tfout + 32
if curr < setp then goto [on2] else goto [off2] 'FAN ON IF CURRENT TEMP < GREATER THEN SETP
wait

[refreshhot]
if statmode == "COLD" then goto [refreshhot]
'cssid htmlid(), "background-color:orange;text-align: center;display:block;width:254px"
curr = temp(1) 'curr ' read current temperature for device 1 db1820 SECOND SENSOR
'outc = temp(0) ' outc ' read current temperature for device 0 db1820 FIRST SENSOR
tf = curr * 9 ' Fahrenheit CONVERSON
tf = tf / 5
tf = tf + 32
tfout = outc * 9
tfout = tfout / 5
tfout = tfout + 32
if curr > setp then goto [on2] else goto [off2] 'FAN ON IF CURRENT TEMP < GREATER THEN SETP
wait

[outcon] ' second db1820s sensor TURN RELAY D5 ON AND STAT ON
io(po,d5,1)
let statout = "ON"
wait

[outcoff] ' second db1820s sensor - TURN RELAY D5 OFF AND STAT OFF
io(po,d5,0)
let statout = "OFF"
wait

[NIL]
wait


User avatar
By joeman2116
#55067 forlotto,

Just tried the new code - no errors but mark highlighting is not displayed

Thanks
Joe



forlotto wrote:Yes of course

thx for pointing that out was not paying close enough attention that I was pasting between quotes when I did not need the quotes.

remove the quotes on the outsides I believe from what mmiscool says like so.

Possibly this should work it may have issues I am not testing just helping solve you can test.

Code: Select all'ESPBASIC V3 A44 ECOSTATcss77 dual statmode
'DB1820S Temp Sensor Data PIN IS D4
'Pin D2 for led or relay output inside
'Pin D5 for led or relay output outside
'edited by forlotto
memclear
cls
let tf = 0
let curr = 0
let outc = 0 'for second temp sensor
let statmode = "TOOHOT"
setp = 19
settemp = 19
let stat = "ON"
let statout = "ON"
let setpout = 19

'cssclass "button", "background-color: #99e6e6;"
cssclass "align-self: center;"
css "test1.css"
wprint "<head>"
wprint "<meta http-equiv='refresh'content='5;URL=/input?'>"
wprint "</head>"
wprint "<body bgcolor='#527a7a'>"
wprint "<table align='center' width='102' bgcolor='lightblue' border='4' cellpadding='1'>"
wprint "<td>"
button "MODE", [NIL]
dropdown statmode, "TOOCOLD,TOOHOT"
cssid htmlid(), "background-color:#008ae6;text-align: center;display:block;width:105px"
wprint "<br>"
wprint "</td>"
wprint "<th</th></table><br>"

wprint "<table align='center' width='150' bgcolor='LIGHTblue' border='2' cellpadding='1'>"
wprint "<td>"
button "FAN IP 77", [NIL]
wprint "<b>"
wprint |<mark style="background-color:yellow;">|
wprint "<center>" & htmlvar(stat) & "</center>"
wprint "</mark>"
wprint "</b>"
'wprint "<br>"
wprint "</td>"
wprint "<th</th></table>"
wprint "<br>"
wprint "<table align='center' width='192' bgcolor='lightblue' border='4' cellpadding='3'>"
wprint "<td>"
wprint "  Dropdown "
dropdown setp, "15,18,19,21,22,23,25,26,27,28,30,32,35,38"
wprint "List"
Button "<B>Trigger Level</B>",[setpt]
textbox setp
cssid htmlid(), "background-color:LIGHTGREEN;text-align: center;display:block;width:170px"

wprint "<center> Current Trigger Level </center>"
wprint "<th</th></table><br>"
wprint "<br>"

wprint "<table align='center' width='200' bgcolor='LIGHTBLUE' border='2' cellpadding='2'>"
wprint "<td>"
button "TEMP-C",[NIL]
cssid htmlid(), "background-color:LIGHTGREEN;text-align: center;display:block;width:120px"

wprint "<b>"
wprint |<mark style="background-color:yellow;">|
wprint "<center>" & htmlvar(curr) & "</center>"
wprint "</mark>"
wprint "</b>"
wprint "</td>"
wprint "<td>"
wprint "<b>"
button "TEMP-F",[NIL]
cssid htmlid(), "background-color:LIGHTGREEN;text-align: center;display:block;width:120px"
wprint |<mark style="background-color:yellow;">|
wprint "<center>" & htmlvar(tfout) & "</center>"
wprint "</mark>"
wprint "</b>"
wprint "</td>"
wprint "<th</th></table><br>"

timer 4000, [refreshcold]
wait
[on2] ' FIRST SENSOR DB1820S ---------
io(po,d5,1)
let stat = "ON"
wait

[off2] ' FIRST SENSOR DB1820S ---------
io(po,d5,0)
let stat = "OFF"
wait

[setpt]
wprint "<head>"
wprint "<meta http-equiv='refresh' content='5;URL=/input?'>"
wprint "</head>"
wait
[refreshcold]

if statmode == "TOOHOT" then goto [refreshhot]
curr = temp(1) 'curr ' read current temperature for device 1 db1820 SECOND SENSOR
'outc = temp(0) ' outc ' read current temperature for device 0 db1820 FIRST SENSOR
tf = curr * 9 ' Fahrenheit CONVERSON
tf = tf / 5
tf = tf + 32
tfout = outc * 9
tfout = tfout / 5
tfout = tfout + 32
if curr < setp then goto [on2] else goto [off2] 'FAN ON IF CURRENT TEMP < GREATER THEN SETP
wait

[refreshhot]
if statmode == "COLD" then goto [refreshhot]
'cssid htmlid(), "background-color:orange;text-align: center;display:block;width:254px"
curr = temp(1) 'curr ' read current temperature for device 1 db1820 SECOND SENSOR
'outc = temp(0) ' outc ' read current temperature for device 0 db1820 FIRST SENSOR
tf = curr * 9 ' Fahrenheit CONVERSON
tf = tf / 5
tf = tf + 32
tfout = outc * 9
tfout = tfout / 5
tfout = tfout + 32
if curr > setp then goto [on2] else goto [off2] 'FAN ON IF CURRENT TEMP < GREATER THEN SETP
wait

[outcon] ' second db1820s sensor TURN RELAY D5 ON AND STAT ON
io(po,d5,1)
let statout = "ON"
wait

[outcoff] ' second db1820s sensor - TURN RELAY D5 OFF AND STAT OFF
io(po,d5,0)
let statout = "OFF"
wait

[NIL]
wait


User avatar
By joeman2116
#55068
joeman2116 wrote:forlotto,

Just tried the new code - no errors but mark highlighting is not displayed

Thanks
Joe

NEW CODE:
Thought for a bit and rearranged the code !!

wprint "<center>"
wprint "<mark>" & htmlvar(stat) & "</mark>"
wprint "</center>"

This works - items are centered and have yellow highlighting.

Thanks for yourhelp, Mike and forlotto

I will post new code and screen shot






forlotto wrote:Yes of course

thx for pointing that out was not paying close enough attention that I was pasting between quotes when I did not need the quotes.

remove the quotes on the outsides I believe from what mmiscool says like so.

Possibly this should work it may have issues I am not testing just helping solve you can test.

Code: Select all'ESPBASIC V3 A44 ECOSTATcss77 dual statmode
'DB1820S Temp Sensor Data PIN IS D4
'Pin D2 for led or relay output inside
'Pin D5 for led or relay output outside
'edited by forlotto
memclear
cls
let tf = 0
let curr = 0
let outc = 0 'for second temp sensor
let statmode = "TOOHOT"
setp = 19
settemp = 19
let stat = "ON"
let statout = "ON"
let setpout = 19

'cssclass "button", "background-color: #99e6e6;"
cssclass "align-self: center;"
css "test1.css"
wprint "<head>"
wprint "<meta http-equiv='refresh'content='5;URL=/input?'>"
wprint "</head>"
wprint "<body bgcolor='#527a7a'>"
wprint "<table align='center' width='102' bgcolor='lightblue' border='4' cellpadding='1'>"
wprint "<td>"
button "MODE", [NIL]
dropdown statmode, "TOOCOLD,TOOHOT"
cssid htmlid(), "background-color:#008ae6;text-align: center;display:block;width:105px"
wprint "<br>"
wprint "</td>"
wprint "<th</th></table><br>"

wprint "<table align='center' width='150' bgcolor='LIGHTblue' border='2' cellpadding='1'>"
wprint "<td>"
button "FAN IP 77", [NIL]
wprint "<b>"
wprint |<mark style="background-color:yellow;">|
wprint "<center>" & htmlvar(stat) & "</center>"
wprint "</mark>"
wprint "</b>"
'wprint "<br>"
wprint "</td>"
wprint "<th</th></table>"
wprint "<br>"
wprint "<table align='center' width='192' bgcolor='lightblue' border='4' cellpadding='3'>"
wprint "<td>"
wprint "  Dropdown "
dropdown setp, "15,18,19,21,22,23,25,26,27,28,30,32,35,38"
wprint "List"
Button "<B>Trigger Level</B>",[setpt]
textbox setp
cssid htmlid(), "background-color:LIGHTGREEN;text-align: center;display:block;width:170px"

wprint "<center> Current Trigger Level </center>"
wprint "<th</th></table><br>"
wprint "<br>"

wprint "<table align='center' width='200' bgcolor='LIGHTBLUE' border='2' cellpadding='2'>"
wprint "<td>"
button "TEMP-C",[NIL]
cssid htmlid(), "background-color:LIGHTGREEN;text-align: center;display:block;width:120px"

wprint "<b>"
wprint |<mark style="background-color:yellow;">|
wprint "<center>" & htmlvar(curr) & "</center>"
wprint "</mark>"
wprint "</b>"
wprint "</td>"
wprint "<td>"
wprint "<b>"
button "TEMP-F",[NIL]
cssid htmlid(), "background-color:LIGHTGREEN;text-align: center;display:block;width:120px"
wprint |<mark style="background-color:yellow;">|
wprint "<center>" & htmlvar(tfout) & "</center>"
wprint "</mark>"
wprint "</b>"
wprint "</td>"
wprint "<th</th></table><br>"

timer 4000, [refreshcold]
wait
[on2] ' FIRST SENSOR DB1820S ---------
io(po,d5,1)
let stat = "ON"
wait

[off2] ' FIRST SENSOR DB1820S ---------
io(po,d5,0)
let stat = "OFF"
wait

[setpt]
wprint "<head>"
wprint "<meta http-equiv='refresh' content='5;URL=/input?'>"
wprint "</head>"
wait
[refreshcold]

if statmode == "TOOHOT" then goto [refreshhot]
curr = temp(1) 'curr ' read current temperature for device 1 db1820 SECOND SENSOR
'outc = temp(0) ' outc ' read current temperature for device 0 db1820 FIRST SENSOR
tf = curr * 9 ' Fahrenheit CONVERSON
tf = tf / 5
tf = tf + 32
tfout = outc * 9
tfout = tfout / 5
tfout = tfout + 32
if curr < setp then goto [on2] else goto [off2] 'FAN ON IF CURRENT TEMP < GREATER THEN SETP
wait

[refreshhot]
if statmode == "COLD" then goto [refreshhot]
'cssid htmlid(), "background-color:orange;text-align: center;display:block;width:254px"
curr = temp(1) 'curr ' read current temperature for device 1 db1820 SECOND SENSOR
'outc = temp(0) ' outc ' read current temperature for device 0 db1820 FIRST SENSOR
tf = curr * 9 ' Fahrenheit CONVERSON
tf = tf / 5
tf = tf + 32
tfout = outc * 9
tfout = tfout / 5
tfout = tfout + 32
if curr > setp then goto [on2] else goto [off2] 'FAN ON IF CURRENT TEMP < GREATER THEN SETP
wait

[outcon] ' second db1820s sensor TURN RELAY D5 ON AND STAT ON
io(po,d5,1)
let statout = "ON"
wait

[outcoff] ' second db1820s sensor - TURN RELAY D5 OFF AND STAT OFF
io(po,d5,0)
let statout = "OFF"
wait

[NIL]
wait


User avatar
By joeman2116
#55069 Thanks to forlotto and Mike for your help.

Full code and screenshot

Code: Select all'ESPBASIC V3 A44 ECOSTATcss29 dual statmode
'DB1820S Temp Sensor Data PIN IS D4
'Pin D2 for led or relay output inside
'Pin D5 for led or relay output outside
'edited by forlotto
memclear
cls
let tf = 0
let curr = 0
let outc = 0 'for second temp sensor
let statmode = "TOOHOT"
setp = 23
settemp = 23
let stat = "ON"
let statout = "ON"
let setpout = 23

'cssclass "button", "background-color: #99e6e6;"
cssclass "align-self: center;"
css "test1.css"
wprint "<head>"
wprint "<meta http-equiv='refresh'content='5;URL=/input?'>"
wprint "</head>"
wprint "<body bgcolor='#527a7a'>"
wprint "<table align='center' width='102' bgcolor='lightblue' border='4' cellpadding='1'>"
wprint "<td>"
button "MODE", [NIL]
dropdown statmode, "TOOCOLD,TOOHOT"
cssid htmlid(), "background-color:#008ae6;text-align: center;display:block;width:105px"
wprint "<br>"
wprint "</td>"
wprint "<th</th></table><br>"

wprint "<table align='center' width='150' bgcolor='LIGHTblue' border='2' cellpadding='1'>"
wprint "<td>"
button "FAN IP 29", [NIL]
wprint "<b>"
wprint "<center>"
wprint "<mark>" & htmlvar(stat) & "</mark>"
wprint "</center>"
wprint "</b>"
wprint "</td>"
wprint "<th</th></table>"
wprint "<br>"
wprint "<table align='center' width='192' bgcolor='lightblue' border='4' cellpadding='3'>"
wprint "<td>"
wprint "  Dropdown "
dropdown setp, "15,18,19,21,22,23,25,26,27,28,30,32,35,38"
wprint "List"
Button "<B>Trigger Level</B>",[setpt]
textbox setp
cssid htmlid(), "background-color:LIGHTGREEN;text-align: center;display:block;width:170px"

wprint "<center> Current Trigger Level </center>"
wprint "<th</th></table><br>"
wprint "<br>"

wprint "<table align='center' width='200' bgcolor='LIGHTBLUE' border='2' cellpadding='2'>"
wprint "<td>"
button "TEMP-C",[NIL]
cssid htmlid(), "background-color:LIGHTGREEN;text-align: center;display:block;width:122px"

wprint "<b>"
wprint "<center>"
wprint "<mark>" & htmlvar(curr) & "</mark>"
wprint "</center>"
wprint "</b>"
wprint "</td>"
wprint "<td>"
wprint "<b>"
button "TEMP-F",[NIL]
cssid htmlid(), "background-color:LIGHTGREEN;text-align: center;display:block;width:122px"
wprint "<center>"
wprint "<mark>" & htmlvar(tfout) & "</mark>"
wprint "</center>"
wprint "</b>"
wprint "</td>"
wprint "<th</th></table><br>"

timer 4000, [refreshcold]
wait
[on2] ' FIRST SENSOR DB1820S ---------
io(po,d5,1)
let stat = "ON"
wait

[off2] ' FIRST SENSOR DB1820S ---------
io(po,d5,0)
let stat = "OFF"
wait

[setpt]
wprint "<head>"
wprint "<meta http-equiv='refresh' content='5;URL=/input?'>"
wprint "</head>"
wait
[refreshcold]

if statmode == "TOOHOT" then goto [refreshhot]
curr = temp(1) 'curr ' read current temperature for device 1 db1820 SECOND SENSOR
'outc = temp(0) ' outc ' read current temperature for device 0 db1820 FIRST SENSOR
tf = curr * 9 ' Fahrenheit CONVERSON
tf = tf / 5
tf = tf + 32
tfout = outc * 9
tfout = tfout / 5
tfout = tfout + 32
if curr < setp then goto [on2] else goto [off2] 'FAN ON IF CURRENT TEMP < GREATER THEN SETP
wait

[refreshhot]
if statmode == "COLD" then goto [refreshhot]
'cssid htmlid(), "background-color:orange;text-align: center;display:block;width:254px"
curr = temp(1) 'curr ' read current temperature for device 1 db1820 SECOND SENSOR
'outc = temp(0) ' outc ' read current temperature for device 0 db1820 FIRST SENSOR
tf = curr * 9 ' Fahrenheit CONVERSON
tf = tf / 5
tf = tf + 32
tfout = outc * 9
tfout = tfout / 5
tfout = tfout + 32
if curr > setp then goto [on2] else goto [off2] 'FAN ON IF CURRENT TEMP < GREATER THEN SETP
wait

[outcon] ' second db1820s sensor TURN RELAY D5 ON AND STAT ON
io(po,d5,1)
let statout = "ON"
wait

[outcoff] ' second db1820s sensor - TURN RELAY D5 OFF AND STAT OFF
io(po,d5,0)
let statout = "OFF"
wait

[NIL]
wait

You do not have the required permissions to view the files attached to this post.