2021-01-05 00:15:16 -03:00
|
|
|
// include the library code:
|
|
|
|
#include <LiquidCrystal.h>
|
|
|
|
|
|
|
|
// initialize the library with the numbers of the interface pins
|
|
|
|
LiquidCrystal lcd(12, 11, 9, 8, 7, 6);
|
|
|
|
byte sensorHum = A7; // Analog pin 7
|
|
|
|
int humedad1;
|
|
|
|
|
|
|
|
void setup() {
|
2022-04-04 17:41:38 -04:00
|
|
|
Serial.begin(9600);
|
|
|
|
lcd.begin(16, 2);
|
2021-01-05 00:15:16 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
//humedad1 = analogRead(sensorHum);
|
|
|
|
humedad1 = map(analogRead(sensorHum), 0 , 1023, 0, 100);
|
|
|
|
String humedad = (String)humedad1;
|
|
|
|
Serial.println("Humedad : " + humedad + "%");
|
|
|
|
if(humedad1 < 30) {
|
2022-04-04 17:41:38 -04:00
|
|
|
lcd.setCursor(0, 0);
|
|
|
|
lcd.print("Humedad : " + humedad + "%");
|
|
|
|
lcd.setCursor(0, 1);
|
|
|
|
lcd.print("Tengo sed =( !!!");
|
2021-01-05 00:15:16 -03:00
|
|
|
} else if(humedad1 > 60) {
|
2022-04-04 17:41:38 -04:00
|
|
|
lcd.setCursor(0, 0);
|
|
|
|
lcd.print("Humedad : " + humedad + "%");
|
|
|
|
lcd.setCursor(0, 1);
|
|
|
|
lcd.print(" Me ahogo!!! =(");
|
2021-01-05 00:15:16 -03:00
|
|
|
} else {
|
2022-04-04 17:41:38 -04:00
|
|
|
lcd.setCursor(0, 0);
|
|
|
|
lcd.print("Humedad : " + humedad + "%");
|
|
|
|
lcd.setCursor(0, 1);
|
|
|
|
lcd.print(" Esto es vida =)");
|
2021-01-05 00:15:16 -03:00
|
|
|
}
|
|
|
|
delay(5000);
|
|
|
|
lcd.clear();
|
2022-04-04 17:41:38 -04:00
|
|
|
}
|