# 8.4 Temperature and Humidity Sensor

## Hardware Wiring

![Digital Temperature](https://2341898987-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LCFDbcteyTR3tQSs-5x%2F-LCFE4dCRQBMq1ajywfh%2F-LCFEAYb1QVxyRv5GTyo%2F025_digitaltemperature.jpg?generation=1526059548719428\&alt=media)

## Sketch

The code can be found at [Examples\_Arduino - sensor-kit-for-arduino - \_025\_DigitalTemperature - \_025\_DigitalTemperature.ino](https://github.com/LongerVisionRobot/Examples_Arduino/blob/master/sensor-kit-for-arduino/_025_DigitalTemperature/_025_DigitalTemperature.ino).

```
int Led=13;       // Define LDE Pin
int buttonpin=3;  // Define pin for digital tempature sensor
int val;          // Define Variable val
void setup()
{
  pinMode(Led,OUTPUT);  // Define pin for tap sensor
  pinMode(buttonpin,INPUT);// Define digital temperature sensor as input
  Serial.begin(9600);
}
void loop()
{
  val=digitalRead(buttonpin); // assign digital pin 3's reading to val
  Serial.println(val);
  if(val==HIGH) // anything detected by digital temperature sensor, LED starts
  {
    digitalWrite(Led,HIGH);
  }
  else
  {
    digitalWrite(Led,LOW);
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://longer-vision-robot.gitbook.io/arduino-full-stack/08_thermist_sensors/025_digitaltemperature.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
