ssd1306 using I2C on the esp8266

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
deshipu
Posts: 1347
Joined: Thu May 28, 2015 5:54 pm

Re: ssd1306 using I2C on the esp8266

Post by deshipu » Sun Oct 09, 2016 7:08 am

I'm sorry, but I don't have it anymore.

User avatar
Ised
Posts: 6
Joined: Mon Aug 26, 2019 7:03 am
Location: UA

Re: ssd1306 using I2C on the esp8266

Post by Ised » Thu Aug 29, 2019 6:27 pm

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()

User avatar
pythoncoder
Posts: 3543
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: ssd1306 using I2C on the esp8266

Post by pythoncoder » Fri Aug 30, 2019 6:09 am

I would temporarily add a print statement in the loop:

Code: Select all

print(temp, hum)
Then you would learn whether the problem is the values not getting updated or the results not being rendered to the screen.
Peter Hinch

User avatar
Ised
Posts: 6
Joined: Mon Aug 26, 2019 7:03 am
Location: UA

Re: ssd1306 using I2C on the esp8266

Post by Ised » Fri Aug 30, 2019 6:32 am

pythoncoder wrote:
Fri Aug 30, 2019 6:09 am
I would temporarily add a print statement in the loop:

Code: Select all

print(temp, hum)
Then you would learn whether the problem is the values not getting updated or the results not being rendered to the screen.
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 terminal
. Then I connected the display and changed print to oled.text ()

I think the problem is in my screen output code

User avatar
Ised
Posts: 6
Joined: Mon Aug 26, 2019 7:03 am
Location: UA

Re: ssd1306 using I2C on the esp8266

Post by Ised » Fri Aug 30, 2019 6:44 pm

Ised wrote:
Fri Aug 30, 2019 6:32 am
pythoncoder wrote:
Fri Aug 30, 2019 6:09 am
I would temporarily add a print statement in the loop:

Code: Select all

print(temp, hum)
Then you would learn whether the problem is the values not getting updated or the results not being rendered to the screen.
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 terminal
. 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

Post Reply