Pysense example I2C not correct

  • Pybytes Beta


    At your forum:
    The pysense example is not correct.
    The pins are wrong.
    i2c = I2C(0, baudrate=100000, pins=('P9', 'P10')) # Initialize the I2C bus

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

    Please correct this example.

  • @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('X, Y, Z:',
    print('Roll:', acc.roll())
    print('Pitch:', acc.pitch())
    print('Yaw:', acc.yaw())

  • @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.

  • Thanks....

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

Log in to reply

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.