The Heltec ESP32 board has a lot of memory and processing power (see below the console from tasmota flasher). Just for the fun sake and maybe an usefull one beside experimenting, I will give a chance to micropython.
The only advantege I see, is that you can access the files and the code running on the board. While are you programming in Arduino, the code is more stable, but you must keep the source code and maybe to keep some versioning of the code for each board you have.
First of all, to install micropython, download download the proper image for your board, find instruction on the oficial site.
Connect the board and browse the .py files from the filesystem. At first, you will see only the boot.py file.
First of all, we want to connect the board to local wifi lan! That’s why I have ESP32 or ESP8266!
wlan = network.WLAN(network.STA_IF) # create station interface
wlan.active(True) # activate the interface
wlan.isconnected() # check if the station is connected to an AP
if not wlan.isconnected():
print('connecting to network...')
wlan.connect('homeWlan', 'my-wifi-passwd') # connect to an AP
while not wlan.isconnected():
print('network config:', wlan.ifconfig())
This will connect to the network and prints the interface information.
Let’s light up the display!
For this, use the ssd1306.py library from the oficial repository: https://github.com/micropython/micropython/blob/master/drivers/display/ssd1306.py
# Heltec LoRa 32 with OLED Display
oled_width = 128
oled_height = 64
# OLED reset pin
i2c_rst = Pin(16, Pin.OUT)
# Initialize the OLED display
i2c_rst.value(1) # must be held high after initialization
# Setup the I2C lines
i2c_scl = Pin(15, Pin.OUT, Pin.PULL_UP)
i2c_sda = Pin(4, Pin.OUT, Pin.PULL_UP)
# Create the bus object
i2c = I2C(scl=i2c_scl, sda=i2c_sda)
# Create the display object
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)
oled.text(wlan.ifconfig(), 0, 0)
oled.text('HELLO WiFi ESP32', 0, 25)
oled.text('escapequotes.net', 0, 55)
#oled.line(0, 0, 50, 25, 1)
Read the docs from the micropython site, you will find a lot of examples http://docs.micropython.org/en/latest/esp32/quickref.html
This solution works, find the discussion here https://rntlab.com/question/heltec-lora-32-micropython-oled-not-working/
Support us getting your parts: