😎Brightness Crouton

BH1750 16-bit Ambient Light Sensor

Product Page

https://shop.breadstick.ca/products/brightness-crouton

Circuit Python Library

https://github.com/adafruit/Adafruit_CircuitPython_BH1750

BH1750 Datasheet

https://www.mouser.ca/datasheet/2/348/Rohm_11162017_ROHMS34826-1-1279292.pdf

Code

"""
Brightness Crouton (BH1750) Demo Code
Breadstick Innovations
April 16, 2024
https://learn.breadstick.ca/breadstick/breadsticks/support-boards/i2c-devices/brightness-crouton
"""

import board
import time
import adafruit_bh1750


crouton_i2c = board.I2C()  # Default Breadstick I2C pins D11(SCL) & D12(SDA)
bh1750 = adafruit_bh1750.BH1750(crouton_i2c)


while True:

    brightness = bh1750.lux

    plotter_data = (brightness,)  # Mu's Plotter only displays tuples, this is a single object tuple
    print(plotter_data)
    
    print(f'Brightness: {brightness} lux')
    print("")

    time.sleep(0.1)

Last updated