Simple test

Ensure your device works with this simple test.

examples/bh1750_simpletest.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# SPDX-FileCopyrightText: 2020 Bryan Siepert, written for Adafruit Industries

# SPDX-License-Identifier: Unlicense
import time
import board
import adafruit_bh1750

i2c = board.I2C()
sensor = adafruit_bh1750.BH1750(i2c)

while True:
    print("%.2f Lux" % sensor.lux)
    time.sleep(1)