> 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/master/lib-mraa-and-upm-sensor-libraries/example-programs/temperature.md).

# Temperature Sensor

TMP006

Code to interface a Temperature sensor(TMP006)

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

from __future__ import print_function
import time, sys, atexit
from upm import pyupm_tmp006 as TMP006

def main():
    # Instantiate the Infrared-Thermopile Sensor on I2C on bus 1
    mySensor = TMP006.TMP006(2)
    # activate periodic measurements
    mySensor.setActive();

    while(1):
        print(&quot;Temperature : &quot;+str(mySensor.getTemperature(True)))
        hex(mySensor.getConfig())
        time.sleep(.5)
# Print out temperature value and config-reg in hex every 0.5 seconds
if __name__ == &#39;__main__&#39;:
    main()
```

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