🍞
Breadstick
  • Breadstick Innovations Website
  • Breadsticks
    • đŸĨ–Raspberry Breadstick
      • Code Examples
        • Demo Code
        • POV Wand
        • Pride Flags POV Wand
        • 6-Axis IMU
        • RGB Blink
        • AsyncIO RGB Blink
        • Digital Input
        • Digital Output
        • PWM
        • ADC
        • Servo Motor
    • đŸĨ–Raspberry Breadstick Lite
    • 🍞Support Boards
      • I2C Devices
        • 🚌I2C Bus Rail Adapter
        • đŸŒĻī¸Weather Crouton
        • 😎Brightness Crouton
        • 📏Distance Crouton
        • đŸĢ¨Motion Crouton
      • I2S Devices
        • đŸ“ĸBoombox
      • SPI Devices
      • đŸ•šī¸Buttons/Switches
    • Learning Resources
    • Troubleshooting
  • Nougat
    • Nougat C3
    • Nougat Quad
    • Installing WLED
  • Pico Slices
    • 🔴Slice 1 - LED Mixer
      • Assembly Guide
      • CircuitPython Code
        • 1 - Blink
        • 2 - Analog Read to Plotter
        • 3 - PWM Fade
        • 4 - Pot Controlled PWM
        • 5 - Gamma Correction
    • âąī¸Slice 2 - Stopwatch
      • Assembly Guide
      • Coding Lessons
        • 1 - 7-Segment Display Intro
        • 2 - Cycling Through All Segments
    • âŦœSlice 3 - 8x8 Dot Matrix
      • Assembly Guide
      • MicroPython Code
        • 1 - Moveable Pixel
        • 2 - Snake
    • Circuit Python Setup
    • Reset Bricked Pico
  • Christmas
    • Christmas Tree DIY kit
  • Protoboards
    • â¤ī¸Proto-Heart
    • đŸĨĒProto-Toast
  • SHOP
Powered by GitBook
On this page
  • Product Page
  • Circuit Python Library
  • BH1750 Datasheet
  • Code

Was this helpful?

  1. Breadsticks
  2. Support Boards
  3. I2C Devices

Brightness Crouton

BH1750 16-bit Ambient Light Sensor

PreviousWeather CroutonNextDistance Crouton

Last updated 1 year ago

Was this helpful?

Product Page

Circuit Python Library

BH1750 Datasheet

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)

🍞
😎
https://github.com/adafruit/Adafruit_CircuitPython_BH1750
https://www.mouser.ca/datasheet/2/348/Rohm_11162017_ROHMS34826-1-1279292.pdf
https://shop.breadstick.ca/products/brightness-crouton