diff --git a/soler_chager.ino b/soler_chager.ino index 3d7dfe1..af54fe6 100644 --- a/soler_chager.ino +++ b/soler_chager.ino @@ -10,7 +10,7 @@ DHT dht(DHT11_PIN, DHT11); volatile int buttonState; -volatile int value = 0; +volatile int lightValue = 0; int count; LiquidCrystal_I2C lcd(0x27, 16, 2); @@ -29,38 +29,40 @@ void setup() lcd.setCursor(0,1); lcd.printstr("hello, Roald!"); - dht.begin(); + dht.begin(20); Serial.print("done setting up!\n"); } void loop()// the loop function runs over and over again forever { - Serial.print("["); - Serial.print(count); - Serial.print("] hey\n"); + //Serial.print("["); + //Serial.print(count); + //Serial.print("] hey\n"); + + lightValue = analogRead(photos); + if (lightValue > 300){ + digitalWrite(LED, HIGH); + } + else{ + digitalWrite(LED, LOW); + } float hum; float temp; temp = dht.readTemperature(); hum = dht.readHumidity(); { - Serial.print("humidity:"); + Serial.print("humidity: "); Serial.print(hum); - Serial.print(" temperature:"); - Serial.println(temp); - delay(200); + Serial.print(" temperature: "); + Serial.print(dht.convertCtoF(temp)); + Serial.print(" light: "); + Serial.println(lightValue); + delay(50); } - value = analogRead(photos); - Serial.println(value); - if (value > 300){ - digitalWrite(LED, HIGH); - } - else{ - digitalWrite(LED, LOW); - } - delay(100); + //delay(100); //blink(); @@ -71,9 +73,9 @@ void loop()// the loop function runs over and over again forever } else { digitalWrite(LED, LOW); } - delay(100); + //delay(100); - count++; + //count++; } void birthdaySong() {