# Brightness Crouton

{% tabs %}
{% tab title="Front" %}

<figure><img src="https://2808519483-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI2jtNl20mw4WYRE8MWgw%2Fuploads%2FlEYBrbbExAlpdQsYhGDz%2F24-04-20%2009-27-46%20oroo.jpg?alt=media&#x26;token=42d080a6-60d5-4cbf-82fc-536f9268dc0d" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Back" %}

<figure><img src="https://2808519483-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI2jtNl20mw4WYRE8MWgw%2Fuploads%2F6XeIz5tMzurhduIQU8tv%2F24-04-20%2009-25-24%20oroo.jpg?alt=media&#x26;token=c931849f-9cce-4b13-b4d9-b249375fc63c" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

## 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

```python
"""
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)
```
