Hello world code for PCT2075 and LM75B component class library. The PCT2075 is a temperature-to-digital converter featuring +/-1 degree-C accuracy over -25 degree-C to +100 degree-C range. It uses an on-chip band gap temperature sensor and Sigma-Delta A-to-D conversion technique with an overtemperature detection output that is a drop-in replacement for other LM75 series thermal sensors.

Dependencies:   PCT2075 mbed

Committer:
okano
Date:
Fri Feb 27 12:35:30 2015 +0000
Revision:
1:5398b0799e20
Parent:
0:3c3d4c5ac8e9
could built, no test done

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okano 0:3c3d4c5ac8e9 1 #include "I2CTempSensor.h"
okano 0:3c3d4c5ac8e9 2 #include "PCT2075.h"
okano 0:3c3d4c5ac8e9 3
okano 0:3c3d4c5ac8e9 4 PCT2075::PCT2075( PinName i2c_sda, PinName i2c_scl, char i2c_address )
okano 0:3c3d4c5ac8e9 5 : I2CTempSensor( i2c_sda, i2c_scl, i2c_address )
okano 0:3c3d4c5ac8e9 6 {
okano 0:3c3d4c5ac8e9 7 init();
okano 0:3c3d4c5ac8e9 8 }
okano 0:3c3d4c5ac8e9 9
okano 0:3c3d4c5ac8e9 10 PCT2075::PCT2075( I2C &i2c_obj, char i2c_address )
okano 0:3c3d4c5ac8e9 11 : I2CTempSensor( i2c_obj, i2c_address )
okano 0:3c3d4c5ac8e9 12 {
okano 0:3c3d4c5ac8e9 13 init();
okano 0:3c3d4c5ac8e9 14 }
okano 0:3c3d4c5ac8e9 15
okano 0:3c3d4c5ac8e9 16 PCT2075::~PCT2075()
okano 0:3c3d4c5ac8e9 17 {
okano 0:3c3d4c5ac8e9 18 }
okano 0:3c3d4c5ac8e9 19
okano 1:5398b0799e20 20 float PCT2075::read( void )
okano 0:3c3d4c5ac8e9 21 {
okano 1:5398b0799e20 22 typedef I2CTempSensor base;
okano 0:3c3d4c5ac8e9 23
okano 1:5398b0799e20 24 return( base::read16() / 256.0 );
okano 0:3c3d4c5ac8e9 25 }
okano 0:3c3d4c5ac8e9 26
okano 0:3c3d4c5ac8e9 27 PCT2075::operator float( void )
okano 0:3c3d4c5ac8e9 28 {
okano 0:3c3d4c5ac8e9 29 return( read() );
okano 0:3c3d4c5ac8e9 30 }