#include <dht.h>

#define DHTPIN 3     // what pin we're connected to
#define DHTTYPE DHT11   // DHT 11
dht DHT;

int ledPin = 13;
int buzzerPin = 8;
int motionSensorPin = 2;

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(motionSensorPin, INPUT);
  Serial.begin(9600);
}

void loop() {
  // Read temperature and humidity
  int chk = DHT.read11(DHTPIN);
  Serial.print("Temperature = ");
  Serial.println(DHT.temperature);
  Serial.print("Humidity = ");
  Serial.println(DHT.humidity);

  // Check for motion
  if (digitalRead(motionSensorPin) == HIGH) {
    digitalWrite(ledPin, HIGH);
    digitalWrite(buzzerPin, HIGH);
    delay(1000);
    digitalWrite(buzzerPin, LOW);
  } else {
    digitalWrite(ledPin, LOW);
    digitalWrite(buzzerPin, LOW);
  }
}