clean up the serial output. and show F instead of C.
This commit is contained in:
parent
8bd54f6e73
commit
7d9d691fc6
1 changed files with 22 additions and 20 deletions
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
DHT dht(DHT11_PIN, DHT11);
|
DHT dht(DHT11_PIN, DHT11);
|
||||||
volatile int buttonState;
|
volatile int buttonState;
|
||||||
volatile int value = 0;
|
volatile int lightValue = 0;
|
||||||
int count;
|
int count;
|
||||||
LiquidCrystal_I2C lcd(0x27, 16, 2);
|
LiquidCrystal_I2C lcd(0x27, 16, 2);
|
||||||
|
|
||||||
|
@ -29,38 +29,40 @@ void setup()
|
||||||
lcd.setCursor(0,1);
|
lcd.setCursor(0,1);
|
||||||
lcd.printstr("hello, Roald!");
|
lcd.printstr("hello, Roald!");
|
||||||
|
|
||||||
dht.begin();
|
dht.begin(20);
|
||||||
|
|
||||||
Serial.print("done setting up!\n");
|
Serial.print("done setting up!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()// the loop function runs over and over again forever
|
void loop()// the loop function runs over and over again forever
|
||||||
{
|
{
|
||||||
Serial.print("[");
|
//Serial.print("[");
|
||||||
Serial.print(count);
|
//Serial.print(count);
|
||||||
Serial.print("] hey\n");
|
//Serial.print("] hey\n");
|
||||||
|
|
||||||
|
lightValue = analogRead(photos);
|
||||||
|
if (lightValue > 300){
|
||||||
|
digitalWrite(LED, HIGH);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
digitalWrite(LED, LOW);
|
||||||
|
}
|
||||||
|
|
||||||
float hum;
|
float hum;
|
||||||
float temp;
|
float temp;
|
||||||
temp = dht.readTemperature();
|
temp = dht.readTemperature();
|
||||||
hum = dht.readHumidity();
|
hum = dht.readHumidity();
|
||||||
{
|
{
|
||||||
Serial.print("humidity:");
|
Serial.print("humidity: ");
|
||||||
Serial.print(hum);
|
Serial.print(hum);
|
||||||
Serial.print(" temperature:");
|
Serial.print(" temperature: ");
|
||||||
Serial.println(temp);
|
Serial.print(dht.convertCtoF(temp));
|
||||||
delay(200);
|
Serial.print(" light: ");
|
||||||
|
Serial.println(lightValue);
|
||||||
|
delay(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
value = analogRead(photos);
|
//delay(100);
|
||||||
Serial.println(value);
|
|
||||||
if (value > 300){
|
|
||||||
digitalWrite(LED, HIGH);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
digitalWrite(LED, LOW);
|
|
||||||
}
|
|
||||||
delay(100);
|
|
||||||
|
|
||||||
//blink();
|
//blink();
|
||||||
|
|
||||||
|
@ -71,9 +73,9 @@ void loop()// the loop function runs over and over again forever
|
||||||
} else {
|
} else {
|
||||||
digitalWrite(LED, LOW);
|
digitalWrite(LED, LOW);
|
||||||
}
|
}
|
||||||
delay(100);
|
//delay(100);
|
||||||
|
|
||||||
count++;
|
//count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void birthdaySong() {
|
void birthdaySong() {
|
||||||
|
|
Loading…
Reference in a new issue