adafruit / Adafruit_CircuitPython_LTR390

CircuitPython library for the LTR390 ambient light and UV sensor
MIT License
7 stars 2 forks source link

Works fine on circuitpython but fails on micropython using blinka on Pico #17

Open mdetweiler opened 6 months ago

mdetweiler commented 6 months ago

MicroPython v1.22.2 on 2024-02-22; Raspberry Pi Pico W with RP2040 Type "help()" for more information.

import busio import board import adafruit_ltr390 i2c = busio.I2C(board.GP1, board.GP0) ltr = adafruit_ltr390.LTR390(i2c) print("UVI:", ltr.uvi, "\t\tAmbient Light:", ltr.lux) Traceback (most recent call last): File "", line 1, in File "/lib/adafruit_ltr390.py", line 420, in uvi File "/lib/adafruit_ltr390.py", line 353, in uvs File "/lib/adafruit_ltr390.py", line 81, in get TypeError: function doesn't take keyword arguments

Seems to be complaining about:

read bytes into buffer at correct alignment

    raw_value = unpack_from(self.format, self.buffer, offset=1)[0]
mdetweiler commented 6 months ago

I think I found the fix: raw_value = unpack_from(self.format, self.buffer, 1)[0]