I am using the LSM303DLH magnetometer/accelerometer with the Raspberry Pi Pico W & CircuitPython.
I have successfully used the adafruit_lsm303dlh_mag library to read the magnetometer data and it works great.
However, I'm encountering an issue with the adafruit_lsm303_accel library.
Problem Description:
When I run the following code, I receive the following error message:
Code: Select all
import time
import board
import adafruit_lsm303_accel
i2c = board.STEMMA_I2C()
sensor = adafruit_lsm303_accel.LSM303_Accel(i2c)
while True:
acc_x, acc_y, acc_z = sensor.acceleration
print('Acceleration (m/s^2): ({0:10.3f}, {1:10.3f}, {2:10.3f})'.format(acc_x, acc_y, acc_z))
time.sleep(1.0)
Code: Select all
ValueError: No I2C device at address: 0x19
- Raspberry Pi Pico W is connected to the LSM303DLH via I2C on pins GP4 and GP5.
- Installed CircuitPython using Thonny and copied the required dependencies into the lib folder on the device.
- Is the LSM303AGR better than the LSM303DLH?
- Does the magnetic field measurements (in adafruit_lsm303dlh_mag) automatically add acceleration compensation? (I assume not)
- Are there any troubleshooting steps I can try to resolve this error?
Any help or suggestions would be greatly appreciated. Thanks!