2021-05-06 08:48:17 +00:00
|
|
|
import time
|
2021-05-18 10:18:41 +00:00
|
|
|
from pimoroni_i2c import PimoroniI2C
|
2021-05-06 08:48:17 +00:00
|
|
|
from breakout_ltr559 import BreakoutLTR559
|
|
|
|
|
2021-05-18 10:18:41 +00:00
|
|
|
PINS_BREAKOUT_GARDEN = {"sda": 4, "scl": 5}
|
|
|
|
PINS_PICO_EXPLORER = {"sda": 20, "scl": 21}
|
|
|
|
|
|
|
|
i2c = PimoroniI2C(**PINS_BREAKOUT_GARDEN)
|
|
|
|
ltr = BreakoutLTR559(i2c)
|
2021-05-06 08:48:17 +00:00
|
|
|
|
|
|
|
part_id = ltr.part_id()
|
|
|
|
print("Found LTR559. Part ID: 0x", '{:02x}'.format(part_id), sep="")
|
|
|
|
|
|
|
|
while True:
|
|
|
|
reading = ltr.get_reading()
|
|
|
|
if reading is not None:
|
|
|
|
print("Lux:", reading[BreakoutLTR559.LUX], "Prox:", reading[BreakoutLTR559.PROXIMITY])
|
|
|
|
|
|
|
|
time.sleep(0.1)
|