Adsense HTML/JavaScript

Sunday, December 12, 2021

arduino-esp32 (ESP32-C3) scan i2c device address, using custom SDA and SCL.

i2c_scanner is a simple sketch scans the I2C-bus for devices. If a device is found, it is reported to the Arduino serial monitor.

With arduino-esp32, the default I2C of "ESP32C3 Dev Modul" is assigned on:
- SDA: GPIO8
- SCL: GPIO9
(ref: arduino-esp32, list the pre-defined function pins of ESP32C3/S2 Dev Module)

But on ESP32-C3-DevKitM-1,GPIO8 is connected to on-board RGB LED (WS2812).
(ref: ESP32-C3-DevKitM-1 User Guide)

So I have to assign I2C to other custom SDA/SCL pins, by calling   Wire.setPins() before Wire.begin().

  Wire.setPins(SDA_pin, SCL_pin);
  Wire.begin();
How it run on ESP32-C3-DevKitM-1, with SSD1306 conected. The detected I2C address is 0x3C.



Next:
~ how it applied to work with ssd1306 I2C OLED.

No comments:

Post a Comment