Seite 1 von 1

Micropython

Verfasst: Samstag 31. August 2019, 18:00
von pythonbrocki
Hallo an das Forum,

bin anfänger und habe ein problem mit der Display Datei ssd1306 installation. Wenn ich via Upload currend script with current name eingebe, wird das script auf dem Heltec gespeichert.

%lsdevice zeigt: boot.py, ssd1306.py, oled_test.py

der scetch:

from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
import utime

pin16 = Pin(16, Pin.OUT)
pin16.on()

i2c = I2C(scl=Pin(15), sda=Pin(4))

oled = SSD1306_I2C(128, 64, i2c)
oled.fill(0)

for i in range(100):
oled.text(str(i), 10, 10)
oled.show()
utime.sleep_ms(100)
oled.fill(0)

Starte ich den scetch, kommt folgende Meldung.

Traceback (most recent call last):

File "C:\Users\bb\Documents\oled_test.py", line 2, in <module>

ImportError: cannot import name SSD1306_I2C

kann jemad einen Tipp abgeben, wo das Problem ist?
Vielen Dank im voraus

Re: Micropython

Verfasst: Sonntag 1. September 2019, 10:28
von __deets__
Das sieht so aus als ob du den nicht auf dem ESP32 ausfuehrst, sondern auf deinem PC. Da gibt es natuerlich kein SSD1306_I2C. Du musst dein Script hochladen & da ausfuehren.

Re: Micropython

Verfasst: Sonntag 1. September 2019, 14:52
von pythonbrocki
Danke für die schnelle Hilfe!