API for MCP9808 precision temprature sensor.
More...
The MCP9808 digital temperature sensor converts temperatures between -20°C and +100°C to a digital word with ±0.5°C (max.) accuracy. The MCP9808 comes with user-programmable registers that provide flexibility for temperature sensing applications. The registers allow user-selectable settings such as Shutdown or low-power modes and the specification of temperature Event and Critical output boundaries. When the temperature changes beyond the specified boundary limits, the MCP9808 outputs an Event signal. The user has the option of setting the event output signal polarity as an active-low or active-high comparator output for thermostat operation, or as temperature event interrupt output for microprocessor-based systems. The event output can also be configured as a Critical temperature output.
Tested with Adafriut MCP9808 board.
|
class | MCP9808_CONFIG |
|
class | MCP9808_REG |
|
class | MCP9808_RESOLUTION |
|
MCP9808 constructor
- Parameters
-
bus | i2c bus the sensor is attached to. |
address. | Device address. Default is 0x18. |
Returns device ID and revision. Typically 0x0400 With ID in the High byte.
Returns hysteresis setting as a float value.
Returns Manufacturer ID. Typically 0x0054;
float getMonitorReg |
( |
MCP9808.MCP9808_REG |
reg | ) |
|
Returns the current value of TCrit, TUpper, TLower registers.
- Parameters
-
reg | - MCP9808_REG enum UPPER_TEMP, LOWER_TEMP or CRIT_TEMP. |
Returns float value representing the current resolution setting.
Returns true if TCrit threshold has been crossed Reflects the state of the bit based on the most recent readTemp() operation.
Returns true if TLower threshold crossed. Reflects the state of the bit based on the most recent readTemp() operation.
Returns true if TUpper threshold crossed Reflects the state of the bit based on the most recent readTemp() operation.
Returns the name of the sensor
void setAlertMode |
( |
int |
command | ) |
|
Sets alert mode. Can use values from MCP9808_CONFIG enum. Values can be combined.
- Parameters
-
command | - a combination of options to set desired alert mode. See spcec sheet. |
void setHysteresis |
( |
MCP9808.MCP9808_CONFIG |
value | ) |
|
Sets hysteresis value.
- Parameters
-
MCP9808_CONFIG | enum value HYST_0, HYST_1_5, HYST_3_0 or HYST_6_0 |
void setMode |
( |
boolean |
celsius | ) |
|
setMode - sets temperature reporting mode.
- Parameters
-
celsius. | Default is true. If false all temps will be reported in fahrenhiet. |
void setMonitorReg |
( |
MCP9808.MCP9808_REG |
reg, |
|
|
float |
value |
|
) |
| |
Sets the value of TCrit, TUpper,TLower registers.
reg - MCP9808_REG enum UPPER_TEMP, LOWER_TEMP or CRIT_TEMP.
- Parameters
-
value | - float value representing the set value |
void setResolution |
( |
MCP9808.MCP9808_RESOLUTION |
value | ) |
|
Sets resolution of temperature conversion.
- Parameters
-
value | - MCP9808_RESOLUTION enum value. RES_LOW = +0.5 C RES_MEDIUM = +0.25 C RES_HIGH = +0.125 C RES_PRECISION = +0.0625 C (default). |
void shutDown |
( |
boolean |
sleep | ) |
|
Will cause the devices to either sleep or wakeup.
- Parameters
-
sleep | . Bool, default true to sleep. false to wake. |
The documentation for this class was generated from the following file:
- /var/lib/jenkins/workspace/upm-doc-stable/build-33/src/mcp9808/MCP9808.java