Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Pysense example I2C not correct

    Scheduled Pinned Locked Moved Comments & Feedback
    pysensei2c bus errorexamplecode
    4 Posts 4 Posters 2.1k Views 4 Watching
    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.
    • G Offline
      gertjanvanhethof Pybytes Beta
      last edited by

      Hi,

      At your forum: https://docs.pycom.io/pycom_esp32/pycom_esp32/tutorial/includes/pysense-examples.html
      The pysense example is not correct.
      The pins are wrong.
      Wrong:
      i2c = I2C(0, baudrate=100000, pins=('P9', 'P10')) # Initialize the I2C bus

      Good:
      i2c = I2C(0, baudrate=100000, pins=('P22', 'P21')) # Initialize the I2C bus

      Please correct this example.

      J M 2 Replies Last reply Reply Quote 2
      • I Offline
        iotmaker
        last edited by

        Thanks....

        Just tested a py sense and is working with the pins as you said

        1 Reply Last reply Reply Quote 0
        • J Offline
          jellium @gertjanvanhethof
          last edited by

          @gertjanvanhethof This has been reported on the Github Pysense library page. The issue has been closed but the documentation has not been updated.
          As @daniel announced it on the forum, one should expect an updated and (more) complete documentation of the new Pysense module quite soon.

          1 Reply Last reply Reply Quote 0
          • M Offline
            mnelsoneorm @gertjanvanhethof
            last edited by mnelsoneorm

            @gertjanvanhethof odd, I had to change a few things:

            import for LIS2HH12 was in lower but file is upper
            "acc = LIS2HH12()" - was getting an error that it didn't want any parameter so I emptied that and it's working now
            I didn't need to change the pins. This is with WiPy 2.0.
            Odd, looking thru the documentation, the pins for I2C don't match between the pysense and any of the boards. Anyway, it's working for me on 9 and 10. - EDIT - Wondering if it's taken care of in the library now instead. I just commented out the line and it still works.

            Edit again - yes, looking in the libraries, it's actually set there which makes more sense anyway.

            Below is working fine:

            from machine import I2C
            from LIS2HH12 import LIS2HH12
            import time

            acc = LIS2HH12()

            while True:
            print('----------------------------------')
            print('X, Y, Z:', acc.read())
            print('Roll:', acc.roll())
            print('Pitch:', acc.pitch())
            print('Yaw:', acc.yaw())
            time.sleep(1)

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • 1 / 1
            • First post
              Last post

            Pycom on Twitter

            Pycom