Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include <BH1750.h>
- #include <LiquidCrystal_I2C.h>
- BH1750 lightMeter;
- LiquidCrystal_I2C lcd(0x27, 16, 2);
- void setup() {
- Wire.begin();
- lightMeter.begin();
- lcd.begin();
- lcd.backlight();
- lcd.setCursor(0, 0);
- lcd.print("BH1750 Test");
- lcd.setCursor(0, 1);
- lcd.print("Please wait...");
- delay(3000);
- lcd.clear();
- }
- void loop() {
- lcd.clear();
- lcd.setCursor(0, 0);
- lcd.print("Light Intensity ");
- lcd.setCursor(5, 1);
- float lux = lightMeter.readLightLevel();
- lcd.print(lux);
- lcd.print(" Lux");
- delay(2000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement