beginning with BH1750, and label light sensors

This commit is contained in:
Roald Batts 2023-01-15 18:38:29 -05:00
parent 7d9d691fc6
commit 3e800795d6

View file

@ -1,16 +1,18 @@
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#include <BH1750.h>
#define DHT11_PIN 7
#define photos A0
#define photoL1 A0
#define LED 3
#define button 2
#define buzzer 6
BH1750 lightMeter;
DHT dht(DHT11_PIN, DHT11);
volatile int buttonState;
volatile int lightValue = 0;
volatile int lightReadL1 = 0;
int count;
LiquidCrystal_I2C lcd(0x27, 16, 2);
@ -40,8 +42,8 @@ void loop()// the loop function runs over and over again forever
//Serial.print(count);
//Serial.print("] hey\n");
lightValue = analogRead(photos);
if (lightValue > 300){
lightReadL1 = analogRead(photoL1);
if (lightReadL1 > 300){
digitalWrite(LED, HIGH);
}
else{
@ -57,8 +59,8 @@ void loop()// the loop function runs over and over again forever
Serial.print(hum);
Serial.print(" temperature: ");
Serial.print(dht.convertCtoF(temp));
Serial.print(" light: ");
Serial.println(lightValue);
Serial.print(" L1 light: ");
Serial.println(lightReadL1);
delay(50);
}