Report Bugs Here

Moderator: Mmiscool

User avatar
By Al McDivitt
#74318 Hi all
Might be me?
ESP Basic 3.0.Alpha 69
Temp,Hum don't print on oled display but show on textbox
new to ESPBasic any help would be great
Thanks in advance
Cheer's
Al McDivitt

My Code (Wemos D1 Mini Pro)

memclear
cls
oled.cls()
PinDHT = 2
DHT.SETUP(11, PinDHT)

i2c.setup(4,5)
timer 1000, [branch] ' ## Time for auto refresh variables ##

oled.print("Current Temperature", 10,1)
oled.print(Temp, 10,10) ' *** Temp not showing on OLED
oled.print("Current Humidity", 10,18)
oled.print(Hum, 10,28) '** Hum not showing on OLED
oled.print("Your IP is:", 10,36)
oled.print(ip(), 30,48)


textbox Temp ' *** Temp IS showing in textbox
Wait


[TestExit]
timer 0
end

[branch]
gosub [readdata]
wait

[readdata]

Temp = DHT.TEMP() 'Current Temperature
Hum = DHT.HUM() 'Current Humidity
User avatar
By Mmiscool
#74324 Convert the number to a string using the str() function.
oled.print(str(Temp), 10,10)


https://docs.google.com/document/d/1EiY ... 20ztyx3ev3
User avatar
By Mmiscool
#74328 At the top of your code set Temp = 0

When you create the text box with a variable that is not initialised it creates the variable as a string by default and not a number.