Skip to content

Latest commit

 

History

History
46 lines (42 loc) · 1.15 KB

File metadata and controls

46 lines (42 loc) · 1.15 KB

Software

#include <Wire.h>
#include <BH1750.h>
#include "rgb_lcd.h"

rgb_lcd lcd;
const int colorR = 0;
const int colorG = 0;
const int colorB = 0;

BH1750 lightMeter;

void setup() {
Serial.begin(9600);
lightMeter.begin();
Serial.println("Running...");
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.setRGB(colorR, colorG, colorB);
// Print a message to the LCD.
lcd.print("Light intensity");
}

void loop() {
uint16_t lux = lightMeter.readLightLevel();
Serial.print("Light: ");
Serial.print(lux);
Serial.println(" lx");

// Clear the bottom line of the LCD
lcd.setCursor(0,1);
lcd.print("                  ");

// For LCD: set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(lux);
delay(1000);
}