Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <DHT.h> //dht sensor library
- DHT dht(4, DHT11); //sensor pin=4, dht type=dht11
- int motor = 3;
- void setup()
- {
- dht.begin();
- pinMode(motor,OUTPUT);
- digitalWrite(motor,LOW);
- }
- void loop() {
- float t = dht.readTemperature();
- float h = dht.readHumidity();
- if(h>60){
- digitalWrite(motor,HIGH);
- delay(2000); // wait for 2 seconds
- digitalWrite(motor,LOW);
- delay(2000); // wait for 2 seconds
- }
- }
Add Comment
Please, Sign In to add comment