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:
Any suggestions are appreciated.
i found a good link;
i had to have oled object inside he loop.
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/