🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    How to use both 2 I2C interface on StickC-Plus2?

    PRODUCTS
    2
    2
    404
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 俺
      俺がガンダムだ
      last edited by

      Env PlatformIO

      platformio.ini:

      ...
      platform = espressif32
      board = m5stick-c
      framework = arduino
      ...
      lib_deps =
      	Wire
      	m5stack/M5Unified
      	m5stack/M5Unit-DDS
      

      Question:

      I connect 2 modules to StickC-Plus2, one on 'grove' port, the other on 'Ext.8-pin'. Is it correct to connect this way( or to say, is it possible to communicate with 2 modules through I2C separately through GPIO25-GPIO26 and GPIO32-GPIO33)? If this is correct, then how should I write the code?

      Currently in my code, I defined the second 'TwoWire' object and initialized a module with it, but communication failed, while default 'TwoWire(0)' works well.

      TwoWire I2C_DDS = TwoWire(1);
      
      ...
      	I2C_DDS.begin(DDS_SDA, DDS_SCL);
      	dds.begin(&I2C_DDS);
      ...
      
      1 Reply Last reply Reply Quote 0
      • kurikoK
        kuriko
        last edited by

        @俺がガンダムだ
        Look at the definition of TwoWire, number should be fixed

        Good morning, and welcome to the Black Mesa Transit System.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post