0
\$\begingroup\$

I want to read the data from a Pimoroni LTR-559 sensor but it only returns None in the code.

Here is the code:

import time
from pimoroni_i2c import PimoroniI2C
from breakout_ltr559 import BreakoutLTR559
PINS_BREAKOUT_GARDEN = {"sda": 4, "scl": 5}
PINS_PICO_EXPLORER = {"sda": 20, "scl": 21}

i2c = PimoroniI2C(sda = 4, scl = 5)
ltr = BreakoutLTR559(i2c)
while True:
    reading = ltr.get_reading()
    print(reading)
    if reading is not None:
        print("Lux:", reading[BreakoutLTR559.LUX], "Prox:", reading[BreakoutLTR559.PROXIMITY])
   
    time.sleep(0.1)

and for the pinout:

| Pico        | LTR559|
| --------    | -------------- |
| 3V3(Pin36)  | Power          |
| GND (Pin38) | GND            |
| SDA1 (Pin4) | SDA            |
| SCL1 (Pin5) | SCL            |

I ignored the int pin because I don't think it's necessary, is that the issue or did I get something else wrong?

\$\endgroup\$
2
  • \$\begingroup\$ Does it work if you read the device ID with print(ltr.part_id())? Also, have you try PimoroniI2C(**PINS_BREAKOUT_GARDEN)? \$\endgroup\$ Commented Apr 29 at 13:33
  • \$\begingroup\$ You can ignore the INT pin for basic reading, so that’s not the direct problem — however, the LTR559 uses interrupt-driven updates, so some library versions won't return data unless an interrupt has triggered. \$\endgroup\$ Commented Apr 29 at 14:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.