Pysense example I2C not correct
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.
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
acc = LIS2HH12()
print('X, Y, Z:', acc.read())
@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.
Just tested a py sense and is working with the pins as you said