> For the complete documentation index, see [llms.txt](https://ruggedboard.gitbook.io/ruggedboard/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ruggedboard.gitbook.io/ruggedboard/lib-mraa-and-upm-sensor-libraries/example-programs/humidity-sensor.md).

# Humidity Sensor

HDC1000

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`
