Mechatronics
Documentation for ME 405 labs
mcp9808.TempSensor Class Reference

A Driver for the mcp9808 temperature sensor. More...

Inheritance diagram for mcp9808.TempSensor:

Public Member Functions

def __init__ (self, master=None, address=BUS_ADDRESS)
 Construct a TempSensor object. More...
 
def check (self)
 Checks if the mcp9808 exists at the specified address and that the manufacturer id matches.
 
def celsius (self)
 Read the temperature in °C. More...
 
def fahrenheit (self)
 Read the temperature in °F. More...
 

Public Attributes

 address
 

Detailed Description

A Driver for the mcp9808 temperature sensor.

The I2C device address can be specified by changing the global BUS_ADDRESS variable. This wrapper subclasses the pyb.I2C object and accesses the mcp9808 as the master device.

Constructor & Destructor Documentation

◆ __init__()

def mcp9808.TempSensor.__init__ (   self,
  master = None,
  address = BUS_ADDRESS 
)

Construct a TempSensor object.

Parameters
masterOptionally wrap an existing I2C.MASTER object.
addressOptionally specify the I2C bus address of the mcp9808.

Member Function Documentation

◆ celsius()

def mcp9808.TempSensor.celsius (   self)

Read the temperature in °C.

Returns
The temperature in °C with a resolution of 0.0625°C

◆ fahrenheit()

def mcp9808.TempSensor.fahrenheit (   self)

Read the temperature in °F.

Returns
The temperature in °F with a resolution of 0.1125°F

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