Adafruit MCP960x Library
Public Member Functions | Protected Attributes | List of all members
Adafruit_MCP9600 Class Reference

MCP9600 driver. More...

#include <Adafruit_MCP9600.h>

Inheritance diagram for Adafruit_MCP9600:
Adafruit_MCP9601

Public Member Functions

 Adafruit_MCP9600 ()
 Instantiates a new MCP9600 class.
 
boolean begin (uint8_t i2c_addr=MCP9600_I2CADDR_DEFAULT, TwoWire *theWire=&Wire)
 Sets up the I2C connection and tests that the sensor was found. More...
 
float readThermocouple (void)
 Read temperature at the end of the thermocouple. More...
 
float readAmbient (void)
 Read temperature at the MCP9600 chip body. More...
 
void enable (bool flag)
 Whether to have the sensor enabled and working or in sleep mode. More...
 
bool enabled (void)
 Whether the sensor is enabled and working or in sleep mode. More...
 
MCP9600_ThemocoupleType getThermocoupleType (void)
 The desired thermocouple type getter. More...
 
void setThermocoupleType (MCP9600_ThemocoupleType)
 The desired thermocouple type setter. More...
 
uint8_t getFilterCoefficient (void)
 The desired filter coefficient getter. More...
 
void setFilterCoefficient (uint8_t)
 The desired filter coefficient setter. More...
 
void setADCresolution (MCP9600_ADCResolution resolution)
 The desired ADC resolution setter. More...
 
MCP9600_ADCResolution getADCresolution (void)
 The desired ADC resolution getter. More...
 
int32_t readADC (void)
 Read the raw ADC voltage, say for self calculating a temperature. More...
 
void setAlertTemperature (uint8_t alert, float temp)
 Setter for alert temperature setting. More...
 
float getAlertTemperature (uint8_t alert)
 Getter for alert temperature setting. More...
 
void configureAlert (uint8_t alert, bool enabled, bool rising, bool alertColdJunction=false, bool activeHigh=false, bool interruptMode=false)
 Configure temperature alert. More...
 
uint8_t getStatus (void)
 Getter for status register. More...
 

Protected Attributes

uint8_t _device_id = 0
 The DEVICE ID high byte for MCP9600 or MCP9601.
 

Detailed Description

MCP9600 driver.

Member Function Documentation

◆ begin()

boolean Adafruit_MCP9600::begin ( uint8_t  i2c_addr = MCP9600_I2CADDR_DEFAULT,
TwoWire *  theWire = &Wire 
)

Sets up the I2C connection and tests that the sensor was found.

Parameters
i2c_addrThe I2C address of the target device, default is 0x67
theWirePointer to an I2C device we'll use to communicate default is Wire
Returns
true if sensor was found, otherwise false.

◆ readThermocouple()

float Adafruit_MCP9600::readThermocouple ( void  )

Read temperature at the end of the thermocouple.

Returns
Floating point temperature in Centigrade

◆ readAmbient()

float Adafruit_MCP9600::readAmbient ( void  )

Read temperature at the MCP9600 chip body.

Returns
Floating point temperature in Centigrade

◆ enable()

void Adafruit_MCP9600::enable ( bool  flag)

Whether to have the sensor enabled and working or in sleep mode.

Parameters
flagTrue to be in awake mode, False for sleep mode

◆ enabled()

bool Adafruit_MCP9600::enabled ( void  )

Whether the sensor is enabled and working or in sleep mode.

Returns
True if in awake mode, False if in sleep mode

◆ getThermocoupleType()

MCP9600_ThemocoupleType Adafruit_MCP9600::getThermocoupleType ( void  )

The desired thermocouple type getter.

Returns
The selected type: MCP9600_TYPE_K, MCP9600_TYPE_J, MCP9600_TYPE_T, MCP9600_TYPE_N, MCP9600_TYPE_S, MCP9600_TYPE_E, MCP9600_TYPE_B or MCP9600_TYPE_R

◆ setThermocoupleType()

void Adafruit_MCP9600::setThermocoupleType ( MCP9600_ThemocoupleType  thermotype)

The desired thermocouple type setter.

Parameters
thermotypeThe desired type: MCP9600_TYPE_K, MCP9600_TYPE_J, MCP9600_TYPE_T, MCP9600_TYPE_N, MCP9600_TYPE_S, MCP9600_TYPE_E, MCP9600_TYPE_B or MCP9600_TYPE_R

◆ getFilterCoefficient()

uint8_t Adafruit_MCP9600::getFilterCoefficient ( void  )

The desired filter coefficient getter.

Returns
How many readings we will be averaging, can be from 0-7

◆ setFilterCoefficient()

void Adafruit_MCP9600::setFilterCoefficient ( uint8_t  filtercount)

The desired filter coefficient setter.

Parameters
filtercountHow many readings we will be averaging, can be from 0-7

◆ setADCresolution()

void Adafruit_MCP9600::setADCresolution ( MCP9600_ADCResolution  resolution)

The desired ADC resolution setter.

Parameters
resolutionCan be MCP9600_ADCRESOLUTION_18, MCP9600_ADCRESOLUTION_16, MCP9600_ADCRESOLUTION_14, or MCP9600_ADCRESOLUTION_12.

◆ getADCresolution()

MCP9600_ADCResolution Adafruit_MCP9600::getADCresolution ( void  )

The desired ADC resolution getter.

Returns
The reslution: MCP9600_ADCRESOLUTION_18, MCP9600_ADCRESOLUTION_16, MCP9600_ADCRESOLUTION_14, or MCP9600_ADCRESOLUTION_12.

◆ readADC()

int32_t Adafruit_MCP9600::readADC ( void  )

Read the raw ADC voltage, say for self calculating a temperature.

Returns
The 32-bit signed value from the ADC DATA register

◆ setAlertTemperature()

void Adafruit_MCP9600::setAlertTemperature ( uint8_t  alert,
float  temp 
)

Setter for alert temperature setting.

Parameters
alertWhich alert output we're getting, can be 1 to 4
tempFloating point temperature in Centigrade

◆ getAlertTemperature()

float Adafruit_MCP9600::getAlertTemperature ( uint8_t  alert)

Getter for alert temperature setting.

Parameters
alertWhich alert output we're getting, can be 1 to 4
Returns
Floating point temperature in Centigrade

◆ configureAlert()

void Adafruit_MCP9600::configureAlert ( uint8_t  alert,
bool  enabled,
bool  rising,
bool  alertColdJunction = false,
bool  activeHigh = false,
bool  interruptMode = false 
)

Configure temperature alert.

Parameters
alertWhich alert output we're getting, can be 1 to 4
enabledWhether this alert is on or off
risingTrue if we want an alert when the temperature rises above. False for alert on falling below.
alertColdJunctionWhether the temperature we're watching is the internal chip temperature (true) or the thermocouple (false). Default is false
activeHighWhether output pin goes high on alert (true) or low (false)
interruptModeWhether output pin latches on until we clear it (true) or comparator mode (false)

◆ getStatus()

uint8_t Adafruit_MCP9600::getStatus ( void  )

Getter for status register.

Returns
8-bit status, see datasheet for bits

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