🍞
Breadstick
Ctrlk
  • Breadstick Innovations Website
  • Breadsticks
    • πŸ₯–Raspberry Breadstick
    • πŸ₯–Raspberry Breadstick Lite
    • 🍞Support Boards
      • I2C Devices
        • 🚌I2C Bus Rail Adapter
        • 🌦️Weather Crouton
        • 😎Brightness Crouton
        • πŸ“Distance Crouton
        • 🫨Motion Crouton
      • I2S Devices
      • SPI Devices
      • πŸ•ΉοΈButtons/Switches
    • Learning Resources
    • Troubleshooting
  • Nougat
    • Nougat C3
    • Nougat Quad
    • Installing WLED
  • Pico Slices
    • πŸ”΄Slice 1 - LED Mixer
    • ⏱️Slice 2 - Stopwatch
    • ⬜Slice 3 - 8x8 Dot Matrix
    • Circuit Python Setup
    • Reset Bricked Pico
  • Christmas
    • Christmas Tree DIY kit
  • Protoboards
    • ❀️Proto-Heart
    • πŸ₯ͺProto-Toast
  • SHOP
Powered by GitBook
On this page
  1. Breadsticks
  2. 🍞Support Boards
  3. I2C Devices

😎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

PreviousWeather CroutonNextDistance Crouton

Last updated 1 year ago

Was this helpful?

  • Product Page
  • Circuit Python Library
  • BH1750 Datasheet
  • Code

Was this helpful?

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