devicescript: SSD1306 I2C OLED 128x64 display not working with ESP32-DevKitC

Describe the bug I’m trying to make a SSD1306 display work with an ESP32 w/ USB Type C, this model specifically: image

I have connected the SDA and SCK pins to pins 21 and 22 respectively, as shown in this pinout diagram: image

And set it up like shown in the docs:

import { SSD1306Driver } from "@devicescript/drivers"

const ssd = new SSD1306Driver({ 
    width: 128, 
    height: 64, 
    devAddr: 0x3d
})
await ssd.init()
ssd.image.print("Hello world!", 0, 0)
await ssd.show()

When I run the project, I get this:

 Unhandled exception
  message: I2C device not found or malfunctioning: I2C -1 dev=61: write [Buffer[2] 80ae], read undefined B
  at init_t main_F0 (pc:75)

NOTE: It works perfectly fine with Micropython, using this driver: https://github.com/micropython/micropython/blob/v1.19.1/drivers/display/ssd1306.py

To Reproduce Steps to reproduce the behavior:

  1. Connect a SSD1306 SDA and SCK pins to an ESP32 DevKit 21 and 22 pins respectively.
  2. Copy/Paste the code from the docs example for SSD1306, and set width, height and devAddr setting accordingly.
  3. Connect the ESP32 device
  4. Run the project

Expected behavior To see a “Hello world” text in the SSD1306 display.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

WAIT. It works now! I had to change the address tho. Evidence: 1692250920136

I just release v2.14.2 which has an improved flow to collect a bug report from Visual Studio Code. After updating the extension, run “DeviceScript: Report Issue”.