Report Bugs Here

Moderator: Mmiscool

User avatar
By Al McDivitt
#74346
Mmiscool wrote:Do you have a return after the bit of code that gets the temp?

Do you have code that writes the variable to the old display after receiving the temp. The oled needs to have the data written to it each time. It won't update by it self.


added the return fined my timer loop problem thanks , also tried just sending a var bull=999 that printed OK
on the oled as str(bull) so tried oled.print(str(DHT.TEMP()) and it works! now to learn about joining strings to add a deg after. thanks so much for all you support here is the working code

memclear
cls
oled.cls()
Temp = 0
Hum = 0
bull=999
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(str(DHT.TEMP()),10,10) ' *** Temp not showing on OLED
oled.print("Current Humidity", 10,18)
oled.print(str(DHT.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



[branch]
gosub [readdata]
wait

[readdata]
Temp = DHT.TEMP() 'Current Temperature
Hum = DHT.HUM() 'Current Humidity
Return
You do not have the required permissions to view the files attached to this post.