MLX90614, Raspberry Pi 4B, and try_lock issue

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
dframe
 
Posts: 2
Joined: Mon Mar 02, 2020 12:53 am

MLX90614, Raspberry Pi 4B, and try_lock issue

Post by dframe »

I have an issue using the MLX90614 Circuit Python library on my Raspberry Pi 4B. I have the MLX connected and it can be seen with i2cdetect from the command line.
Any help would be greatly appreciated!

Code (from the comments in the library code):
import board
import adafruit_mlx90614
i2c = board.I2C
mlx = adafruit_mlx90614.MLX90614(i2c)
temperature = mlx.ambient_temperature
print (temperature)


Traceback:
sudo python3 firstTempTest.py
Traceback (most recent call last):
File "firstTempTest.py", line 6, in <module>
mlx = adafruit_mlx90614.MLX90614(i2c)
File "/home/pi/projects/annealer/adafruit_mlx90614.py", line 108, in __init__
self._device = i2c_device.I2CDevice(i2c_bus, address)
File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 50, in __init__
self.__probe_for_device()
File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 151, in __probe_for_device
while not self.i2c.try_lock():
AttributeError: 'function' object has no attribute 'try_lock'

Thanks in advance!

User avatar
dframe
 
Posts: 2
Joined: Mon Mar 02, 2020 12:53 am

Re: MLX90614, Raspberry Pi 4B, and try_lock issue

Post by dframe »

Looks like I was being a bonehead. The issue was in line 5, I needed to use parentheses to call the function, rather than use the function as a value. I missed that as I copied it over. Problem solved.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”