ERROR reading in XRPLib.defaults

I have the following code in my hello world example:

from XRPLib.defaults import *
print(“hello”)

I get the following error:

MicroPython v1.20.0 on 2023-04-26; Raspberry Pi Pico W with RP2040
Type “help()” for more information.

OKTraceback (most recent call last):
File “”, line 5, in
File “hello.py”, line 4, in
File “/lib/XRPLib/defaults.py”, line 19, in
File “/lib/XRPLib/imu.py”, line 26, in get_default_imu
File “/lib/XRPLib/imu.py”, line 59, in init
File “/lib/XRPLib/imu.py”, line 155, in is_connected
File “/lib/XRPLib/imu.py”, line 106, in _getreg
OSError: [Errno 110] ETIMEDOUT

I went into my defaults.py file and commented out line 19 and 20. I was then able to run this program.

17 left_motor = EncodedMotor.get_default_encoded_motor(index=1)
18 right_motor = EncodedMotor.get_default_encoded_motor(index=2)
19 #imu = IMU.get_default_imu()
20 #drivetrain = DifferentialDrive.get_default_differential_drive()
21 rangefinder = Rangefinder.get_default_rangefinder()
22 reflectance = Reflectance.get_default_reflectance()

Any idea why I have to comment out these two lines to get the hello world to work?

OSError: [Errno 110] ETIMEDOUT

This error usually comes up if an I2C device (such as the IMU on the control board) does not respond. Since commenting out the IMU and drivetrain (which uses the IMU) resolves the error message, my guess is that the IMU on your board may be malfunctioning.

Could you please run an I2C scan to confirm whether the IMU sends an acknowledgement? If not, then your board is likely defective, and I’d suggest going through SparkFun’s support directly to resolve it (most likely RMA to get a replacement).

Hope this helps!