float temp;
int tempPin = 0;
int pinSensor=4;
int pinLed=7;
int pinBuzzer=11;
int pirSensor=0;
void setup()
{
  Serial.begin(9600)
  pinMode(pinSensor,OUTPUT);
  pinMode(pinBuzzer,OUTPUT);
  pinMode(pinLed,OUTPUT);
  Serial.begin(115200);
}
void loop()
{
  pirSensor=digitalRead(pinSensor);
  if (pirSensor==HIGH)
  {
    digitalWrite(pinLed,HIGH);
    tone(pinBuzzer,1000,500);
    delay(1000);
    digitalWrite(pinLed,LOW);
  temp = analogRead(tempPin);
  temp = temp * 0.48828125;
  Serial.print("Temperature =");
  Serial.print(temp);
  Serial.print("*C");
  Serial.println();
  delay(1000);
    }
    else
    {
      digitalWrite(pinLed,LOW);
    }
    delay(10);
}
Loading
ds18b20