M5Atom I2c



  • Hi all,
    i'm playing with the mpu6886, with the Arduino lib i can read it.
    how can i use the "grove" connector (g26,g32) with a i2c device at the same time?

    thx Michael



  • ok...i find out that i have to use SoftwareI2c and the i2c device must have pullup resistors:

    #include "SoftwareI2C.h"

    SoftwareI2C softwarei2c;

    void setup() {
    Serial.begin(115200);
    softwarei2c.begin(26, 32); // sda, scl
    Serial.println("begin to scan...");
    }

    void loop() {
    for (unsigned char i = 1; i <= 127; i++) {
    if (softwarei2c.beginTransmission(i)) {
    Serial.print("0x");
    Serial.println(i, HEX);

            while (1);
        }
        softwarei2c.endTransmission();
    }
    
    Serial.println("find nothing");
    while (1);
    

    }