Simple test
Ensure your device works with this simple test.
examples/ltr329_simpletest.py
1# SPDX-FileCopyrightText: Copyright (c) 2022 ladyada for Adafruit Industries
2#
3# SPDX-License-Identifier: Unlicense
4
5import time
6
7import board
8
9from adafruit_ltr329_ltr303 import LTR329
10
11i2c = board.I2C() # uses board.SCL and board.SDA
12# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
13
14time.sleep(0.1) # sensor takes 100ms to 'boot' on power up
15ltr329 = LTR329(i2c)
16
17while True:
18 print("Visible + IR:", ltr329.visible_plus_ir_light)
19 print("Infrared :", ltr329.ir_light)
20 print()
21 time.sleep(0.5) # sleep for half a second