Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h>
- #include <dht.h>
- LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
- dht DHT;
- #define dht_dpin A5
- int umidade;
- const int bd = 7;
- const int be = 8;
- void setup() {
- lcd.begin(16, 2); //LCD
- pinMode(be, INPUT_PULLUP);
- pinMode(bd, INPUT_PULLUP);
- }
- void loop() {
- umidade = analogRead(A0);
- if(digitalRead(be) == LOW){
- lcd.clear();
- umidade = map(umidade, 1023,350 ,0,100);
- lcd.setCursor(0, 0);
- lcd.print("[H] solo:");
- lcd.setCursor(12, 0);
- lcd.print(umidade);
- lcd.print("%");
- delay(2000);
- }
- if(digitalRead(bd) == LOW)
- {
- lcd.clear();
- DHT.read11(dht_dpin); // informações do sensor
- lcd.setCursor(0,1);
- lcd.print("Temp:");
- lcd.setCursor(10,1);
- lcd.print(DHT.temperature);
- lcd.print("C");
- delay(2000);
- }
- else
- {
- lcd.clear();
- lcd.setCursor(0,0);
- lcd.print("Sensores");
- delay(50);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement