Getting started with the OLED display on a TTGO ESP32 LoRa board
A while back I bought an ESP32-based LoRa board from my local hackspace during an evening LoRaWAN workshop, and haven't really had a chance to play with it yet. I thought getting the OLED display to work could be fun as a first attempt.
First I tried the Arduino route using Adafruit's SSD1306 library, with some modifications as described here, but could not get it to work at all.
Then I found an Instructable describing how to install MicroPython on the board and get it working that way. But nope, still no luck.
Using the pinout diagram and Arduino test code in this repo, I figured out that the I2C pins had to be set as follows:
i2c = machine.I2C(scl=machine.Pin(22), sda=machine.Pin(21))
Finally, I had it working in MicroPython! I went back to the Arduino code, changed it to pin 21 and 22 (instead of pin 4 and 15 as in the original tutorial) and lo and behold, it was working there too!