Skip to content

tannewt/Adafruit_CircuitPython_MCP9808

 
 

Repository files navigation

Introduction

The MCP9808 is an awesome, high accuracy temperature sensor that communicates over I2C. Its available on Adafruit as a breakout.

Dependencies

This driver depends on the Bus Device library. Please ensure it is also available on the CircuitPython filesystem. This is easily achieved by downloading a library and driver bundle.

Usage Notes

Getting the temperature in Celsius is easy! First, import all of the pins from the board, busio for native I2C communication and the thermometer library itself.

from board import *
import busio
import adafruit_mcp9808

Next, initialize the I2C bus in a with statement so it always gets shut down ok. Then, construct the thermometer class:

# Do one reading
with busio.I2C(SCL, SDA) as i2c:
    t = adafruit_mcp9808.MCP9808(i2c)

    # Finally, read the temperature property and print it out
    print(t.temperature)

API Reference

.. toctree::
   :maxdepth: 2

   api

About

CircuitPython drivers for the MCP9808 i2c high accuracy temperature sensor.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%