Library for ADT7410 I2C temperature sensor. Use this instead of TMP102 when you need to measure temperatures lower than -40 degrees C. The device is guaranteed to work at -55 C but will actually read lower temps. See http://mbed.org/users/tkreyche/notebook/adt7140-i2c-temperature-sensor/ for more info.

Dependents:   BLE_ADT7410_TMP102_Sample BLE_HTM_HRM1017 BLENano_SimpleTemplate_temp_170802 BLENano_SimpleTemplate_temp_170813 ... more

Embed: (wiki syntax)

« Back to documentation index

ADT7410 Class Reference

ADT7410 Class Reference

Example: More...

#include <ADT7410.h>

Public Member Functions

 ADT7410 (PinName sda, PinName scl, char addr, int hz)
 Create a temperature sensor object.
 ~ADT7410 ()
 Destroys object.
float getTemp ()
 Reads the current temperature.
void setConfig (char regVal)
 Change config register, currently only used to reduce power via 1SPS mode.
char getConfig ()
 Read back config register.
void reset ()
 Reset sensor to default setting.

Detailed Description

Example:

 #include "mbed.h"
 #include "ADT7410.h"

 ADT7410 tempSens1(p28, p27, 0x90, 100000);

 int main() {

   // reset sensor to default values
   tempSens1.reset();

   // read the config register, should be default
   printf("Config: 0x%x\n", tempSens1.getConfig());

   // reduce sample rate to save power
   tempSens1.setConfig(ONE_SPS_MODE);

   // check config register was set correctly
   printf("Config: 0x%x\n", tempSens1.getConfig());

   // get temperature every two seconds
   while (1) {
       printf("Deg C %f\n", tempSens1.getTemp());
       wait(2);
   }
 }

Definition at line 75 of file ADT7410.h.


Constructor & Destructor Documentation

ADT7410 ( PinName  sda,
PinName  scl,
char  addr,
int  hz 
)

Create a temperature sensor object.

Parameters:
sdaI2C data
sclI2C clock
addrI2C bus address
hzI2C bus speed

Definition at line 5 of file ADT7410.cpp.

~ADT7410 (  )

Destroys object.

Definition at line 13 of file ADT7410.cpp.


Member Function Documentation

char getConfig (  )

Read back config register.

Definition at line 53 of file ADT7410.cpp.

float getTemp (  )

Reads the current temperature.

Definition at line 17 of file ADT7410.cpp.

void reset (  )

Reset sensor to default setting.

Definition at line 65 of file ADT7410.cpp.

void setConfig ( char  regVal )

Change config register, currently only used to reduce power via 1SPS mode.

Parameters:
regValnew config register value, see datasheet for details

Definition at line 46 of file ADT7410.cpp.