ME405: Mechatronics
Project Documentation and Portfolio by Neil Patel
mcp9808.iic Class Reference

Class that allows the user to communicate with the MCP9808 temperature sensor using its I2C interface. More...

Public Member Functions

def __init__ (self, i2c, addr)
 Initializer for the class. More...
 
def check (self)
 Verifies the sensor connection. More...
 
def celcius (self)
 Measures the temperature in degrees Celcius. More...
 
def fahrenheit (self)
 Measures the temperature in degrees Fahrenheit. More...
 

Public Attributes

 sens
 
 address
 

Detailed Description

Class that allows the user to communicate with the MCP9808 temperature sensor using its I2C interface.

This class creates a MCP object that interfaces with the I2C object. The initializer is given a reference to an already created I2C object and the address of the MCP9808 on the I2C bus. This class also contains methods to veriy the sensor, and take temperature readings in Celcius and Fahrenheit.

Constructor & Destructor Documentation

◆ __init__()

def mcp9808.iic.__init__ (   self,
  i2c,
  addr 
)

Initializer for the class.

Initializes the class using the reference to the I2C object and the MCP9808 address.

Parameters
i2cI2C The I2C Serial Communication object.
addrint The address of the MCP9808
Returns
Returns nothing.

Member Function Documentation

◆ celcius()

def mcp9808.iic.celcius (   self)

Measures the temperature in degrees Celcius.

Returns
Returns a float that contains the measured temperature in degrees Celcius.

◆ check()

def mcp9808.iic.check (   self)

Verifies the sensor connection.

Verifies that the sensor is attached at the given bus address by checking the returned manufacture ID.

Returns
Returns a boolean verifying the sensor connection.

◆ fahrenheit()

def mcp9808.iic.fahrenheit (   self)

Measures the temperature in degrees Fahrenheit.

Returns
Returns a float that contains the measured temperature in degrees Fahrenheit.

The documentation for this class was generated from the following file: