Post about your Basic project here

Moderator: Mmiscool

User avatar
By joeman2116
#48577 Forlotto,

Thanks for the feedback.
I forgot to remove the serial print - as i was testing to see the temperature.

I worked on the code last night and now all is working perfect.

1. Next is to see if how much code has to be changed for it towork with ESPBasic version 3
I know it wont as is but besides the po code am not sure.. Hopefully not too much code change


2.Then see if I can add a password or authentication page.
I know with nodemcu using lua it takes about 6 lines. No idea what can be done in ESPBasic.

Joe

Pic shows current Display
You do not have the required permissions to view the files attached to this post.
User avatar
By forlotto
#48579 Excellent good to see you got it going...

Now for changes there are commas you may need to add mainly it appears to be right before the sub you mention... There are examples of this already on the forum somewhere there are a few other things that are different as well but the improvement that comes out of the change is pretty radical it allows for far more complex equations etc....


Just grind it out learn the syntax as it will enable you to do more but I would say it looks fairly easy to learn the differences while I have yet to migrate myself not that I am being a windows xp hold out or something I just have not had the time to monkey around and my devices are all loaded with older versions as of now.

Cool to see hopefully when you are done you create a separate post in projects and share your project/expirences and maybe even a video of some of the sweet action on your temp sensor/thermostat!

Have a good one!

-forlotto
User avatar
By joeman2116
#48726 I have the Program working well as a version 2. I have tried converting it to v3 but having problems.

Issues:

1. All my html styles - no longer work... no error but no style

2. I changed the po d2 0 ver2 command to v3 - ---- io po,d2,0 still getting errors

Is there any method to convert a ver 2 program or is it going thru all the code and rebuilding with new commands.?

Thanks
Joe
User avatar
By joeman2116
#48728 I am working on version 2 and trying to add a few buttons to allow me to manually turn on the output device.

I added the fan on/off buttons and when i click on them they work, but only stay on for about 5 secs.
The issue is the page refresh which occurs about every 5 sec to update the temperature comparison and current temp update.
This causes the output device to go off or on depending what the current temp is.

I am trying to add a Auto or manual mode.

I need to add a Mode button which puts the program in[b] auto or manual[/b].

Auto would let the set temperature control the output device - normal
Manual would allow the ON / OFF buttons to take control and allow the buttons to turn on/off output device., but still all the current temperature to update.

Tried all kinds of logic but not good.

CODE:

'ESPBASIC V2
'DB1820S Temp Sensor Data PIN IS D4
'Pin D2 for led or relay output

memclear
'SERIALPRINTLN "restart page"
cls
let tf = 0
let curr = 0
let setp = 31
let stat = On
let mode = manual

wprint "<head>"
wprint "<meta http-equiv='refresh'content='5;URL=/input?'>"
wprint "</head>"
wprint "<body bgcolor='lightgrey'>"

wprint "<table align='center' width='320' bgcolor='lightblue' border='6' cellpadding='5'>"
wprint "<th><h2><b>WiFi Eco Thermostat</h2></b></th>"
wprint "<th</th></table><br>"

wprint "<table align='center' width='318' bgcolor='lightblue' border='4' cellpadding='5'>"
wprint "<td>"
Button " Manual Test Fan On" [on2]
Button " Manual Test Fan Off" [off2]
wprint "</td>"
wprint "<th</th></table><br>"

wprint "<table align='center' width='240' bgcolor='#99ff66' border='4' cellpadding='3'>"
wprint "<td>"
wprint "<b>--Heat/Cooling Fan is--<b/>"
wprint htmlvar(stat)
wprint "</td>"
wprint "<th</th></table><br>"
wprint "<br><br>"

wprint "<table align='center' width='340' bgcolor='yellow' border='5' cellpadding='5'>"
wprint "<td>"
Button "Set Temperature" [setpt]
textbox setp
wprint "<th</th></table><br>"
wprint "<br>"

wprint "<table align='center' width='330' bgcolor='lightgreen' border='5' cellpadding='15'>"
wprint "<td>"
wprint "<b>Current Temp- Celsius= <b/>"
wprint htmlvar(curr)
wprint "</td>"
wprint "<th</th></table><br>"

wprint "<table align='center' width='330' bgcolor='lightgreen' border='5' cellpadding='15'>"
wprint "<td>"

wprint "<b>Current Temp- Fahrenheit= <b/>"
wprint htmlvar(tf)
wprint "</td>"
wprint "<th</th></table><br>"
wprint "<br>"


Button "Exit" [quit]
timer 5000, [refresh]
wait

[on2]
po D2 1
let stat = "ON"
Wait

[off2]
po D2 0
let stat = "OFF"
Wait

[setpt]
wprint "<head>"
wprint "<meta http-equiv='refresh' content='5;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
if curr > setp then goto [on2] else goto [off2] 'FAN ON IF CURRENT TEMP IS GREATER THEN SETP
wait

[quit]
timer 0
wprint "<a href='/'>Menu</a>"
end
You do not have the required permissions to view the files attached to this post.