From 3e800795d6766680505e5c4b9821154b96b9d7b3 Mon Sep 17 00:00:00 2001 From: Roald Batts Date: Sun, 15 Jan 2023 18:38:29 -0500 Subject: [PATCH] beginning with BH1750, and label light sensors --- soler_chager.ino | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/soler_chager.ino b/soler_chager.ino index af54fe6..b24d948 100644 --- a/soler_chager.ino +++ b/soler_chager.ino @@ -1,16 +1,18 @@ #include #include #include +#include #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); }