# Humidity Sensor

Code to interface humidity sensor(HDC1000)

```
#!/usr/bin/env python

from __future__ import print_function
import time, sys, atexit
from upm import pyupm_hdc1000 as HDC1000

def main():
    # Instantiate the Temperature and Humidity Sensor on I2C on bus 0
    mySensor = HDC1000.HDC1000(0)
    # Print out the humidity and temperature value every 0.5 seconds
    while(1):
        print("Humidity : "+str(mySensor.getHumidity(True)))
        print("Temperature : "+str(mySensor.getTemperature(True)))
        time.sleep(.5)
if __name__ == '__main__':
    main()
```

**To run the program,** \
**Step 1: save the file as hdc1000.py**\
**Step 2: Run the Program in the board's terminal using** `python3 hdc1000.py`


---

# 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://ruggedboard.gitbook.io/ruggedboard/master/lib-mraa-and-upm-sensor-libraries/example-programs/humidity-sensor.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.
