beginning with BH1750, and label light sensors
This commit is contained in:
parent
7d9d691fc6
commit
3e800795d6
1 changed files with 8 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue