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