• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ssd1306 OLED text displays blocks – microPython

Q&A Forum › Category: ESP32 › ssd1306 OLED text displays blocks – microPython
0 Vote Up Vote Down
vgershman asked 4 years ago

Hello,

I am trying to display sensor values to OLED ssd1306 using Micropython. “Hello World” example from MicroPython works. However, when i run “oled.text” in a while loop, i get the some values as solid blocks , not numbers. Below is my code :

while i < 50 :
water_sensor_value = 3.3*(water_sensor.read())/4095

pwr9v_value = 3.3*((pwr9v.read())/4095)

print ("i = ", i , "water sens =", water_sensor_value, "pwr9v = ", pwr9v_value)

water_sensor_str = 'wt_sn = ' + str(water_sensor_value) + "X"
pwr_sensor_str = "9V div =" + str(pwr9v_value)
count_str = "i = " + str(i) + 'X'

oled.text(water_sensor_str, 0, 0)
oled.text(pwr_sensor_str, 0, 10)
oled.text(count_str, 0, 20)

oled.show()
i = i + 1

#with delay of 2 power reading is more stable
sleep (2)

here is how it looks:

https://imgur.com/a/TlPLSRK#gjwGeHK

Any suggestions are appreciated.

Thanks

Question Tags: ESP32, MicroPython, OLED, oled.text
2 Answers
0 Vote Up Vote Down
vgershman answered 4 years ago

i found a good link;

diyprojects.io/oled-display-ssd1306-micropython-example-digital-barometer-bme280-i2c

i had to have oled object inside he loop.

thanks

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

I’m glad you found the solution and thanks for marking it as “Resolved” If you have more questions, feel free to post them here: https://rntlab.com/ask-question/
Regards,
Rui

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] SMART HOME with RPi, ESP32, and ESP8266 (version 1.2) March 8, 2023
  • [eBook Updated] ESP32-CAM Projects (version 1.3) January 7, 2023

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2023 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.