Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "DHT.h"
- #include <LiquidCrystal.h>
- #include <Servo.h>// inclui biblioteca de manipulação de servos motores.
- #define DHTPIN 2 // what pin we're connected to
- #define DHTTYPE DHT22
- DHT dht(DHTPIN, DHTTYPE);
- LiquidCrystal lcd(8,9,4,5,6,7);
- Servo motor;
- void setup(void) {
- motor.attach(13);
- lcd.begin(16, 2);
- lcd.print("Reading sensor");
- dht.begin();
- }
- void loop() {
- float temperature, humidity;
- humidity = dht.readHumidity();
- temperature = dht.readTemperature();
- delay(2000);
- lcd.clear();
- char tempF[6];
- char humF[6];
- dtostrf(temperature, 5, 1, tempF);
- dtostrf(humidity, 2, 0, humF);
- lcd.print("T:");
- lcd.print(tempF);
- lcd.print((char)223);
- lcd.print("C ");
- lcd.print("H: ");
- lcd.print(humF);
- lcd.print("%");
- //principal
- motor.write(0); //aqui o motor ficará a 0 graus
- delay(50000); //5 minutos
- motor.write(90); //aqui o motor ficará em 90 graus
- delay(50000); // espera 5 minutos
- motor.write(180); //aqui o motor ficará a 0 graus
- delay(50000); // espere 5 minutos
- motor.write(90); //aqui o motor ficará em 180 graus
- delay(50000); // espere 5 minutos
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement