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

    Re: I2C slave mode doesn't work for UnitV Stick

    Units
    1
    1
    2.0k
    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.
    • T
      TakekazuKATO
      last edited by

      Is this problem already solved?

      I encountered the same problem and found a solution.
      I think this is a mistake in the sample program.

      Although the variable `count' in the function i2c_on_transmit must be global it is interpreted as a local variable.

      I have modified the i2c_on_transmit() as follows.

      def i2c_on_transmit()
        global count
        count = count + 1
        print ("on_transmit, send:", count)
        return count
      

      Then, it worked well.

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