ssd1306 using I2C on the esp8266
Re: ssd1306 using I2C on the esp8266
I'm sorry, but I don't have it anymore.
Re: ssd1306 using I2C on the esp8266
Hello! I am trying to display information from dht 11 to oled display 128x64. I am using the ssd1306.py library.
Information is displayed, but is not updated. What am I doing wrong?
from machine import Pin, I2C
import ssd1306
import dht
from time import sleep
i2c = I2C(-1, scl=Pin(5), sda=Pin(4))
oled_width = 128
oled_height = 64
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)
d = dht.DHT11(Pin(14))
while True:
sleep(2)
d.measure()
temp = d.temperature()
hum = d.humidity()
oled.text(temp, 0,0)
oled.text(hum, 0, 0)
oled.show()
Information is displayed, but is not updated. What am I doing wrong?
from machine import Pin, I2C
import ssd1306
import dht
from time import sleep
i2c = I2C(-1, scl=Pin(5), sda=Pin(4))
oled_width = 128
oled_height = 64
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)
d = dht.DHT11(Pin(14))
while True:
sleep(2)
d.measure()
temp = d.temperature()
hum = d.humidity()
oled.text(temp, 0,0)
oled.text(hum, 0, 0)
oled.show()
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: ssd1306 using I2C on the esp8266
I would temporarily add a print statement in the loop:
Then you would learn whether the problem is the values not getting updated or the results not being rendered to the screen.
Code: Select all
print(temp, hum)
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: ssd1306 using I2C on the esp8266
Thanks for the answer. but the first time I connected without a display. and used print. information in the cycle was updated. received output to the terminalpythoncoder wrote: ↑Fri Aug 30, 2019 6:09 amI would temporarily add a print statement in the loop:Then you would learn whether the problem is the values not getting updated or the results not being rendered to the screen.Code: Select all
print(temp, hum)
. Then I connected the display and changed print to oled.text ()
I think the problem is in my screen output code
Re: ssd1306 using I2C on the esp8266
Ised wrote: ↑Fri Aug 30, 2019 6:32 amThanks for the answer. but the first time I connected without a display. and used print. information in the cycle was updated. received output to the terminalpythoncoder wrote: ↑Fri Aug 30, 2019 6:09 amI would temporarily add a print statement in the loop:Then you would learn whether the problem is the values not getting updated or the results not being rendered to the screen.Code: Select all
print(temp, hum)
. Then I connected the display and changed print to oled.text ()
I think the problem is in my screen output code
Thank ! I decided. The problem was incorrect formatting of the output tex