A Demo shown how to make 2 I2C devices work together on ESP8266.
Parts Required
- NodeMCU v1.0 (base on ESP8266 ESP-12E), or any base on ESP8266 module (code Wire.begin(SDA, SCL) with changed require for SDA/SCL pins. (Ex: Wire.begin(2, 0) for ESP-01 module.)
- I2C device: -- Monochrome 128x64 OLED graphic display : SSD1306 ( or SH1106) x1 -- Six-Axis (Gyro + Accelerometer) MotionTracking Device : MPU 6050 x1
Hardware Connect
- SDA of I2C devices (OLED/MPU6050) -> D2 (for NodeMCU) or GPIO 2 (for ESP-01)
- SCL of I2C devices (OLED/MPU6050) -> D1 (for NodeMCU) or GPIO 0 (for ESP-01)
Precautions
- In theory this code could be built on Arduino AVR device (ATmega328P) vs Arduino IDE. But I got a global variables > 2048 KB, out of memory error and hard to reduce.
VERSION: 0.1
Depends on the following Arduino libraries.
3D Cube Code Reference