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 10:47:24 2015 +0000
Revision:
0:3c3d4c5ac8e9
Child:
2:edd678dcf504
cannot built

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okano 0:3c3d4c5ac8e9 1 /** Hello code for "test_LM75B" */
okano 0:3c3d4c5ac8e9 2
okano 0:3c3d4c5ac8e9 3 #include "mbed.h"
okano 0:3c3d4c5ac8e9 4 #include "PCT2075.h"
okano 0:3c3d4c5ac8e9 5
okano 0:3c3d4c5ac8e9 6 PCT2075 temp0( p28, p27 );
okano 0:3c3d4c5ac8e9 7
okano 0:3c3d4c5ac8e9 8 I2C i2c( p28, p27 );
okano 0:3c3d4c5ac8e9 9 PCT2075 temp1( i2c );
okano 0:3c3d4c5ac8e9 10
okano 0:3c3d4c5ac8e9 11
okano 0:3c3d4c5ac8e9 12 int main()
okano 0:3c3d4c5ac8e9 13 {
okano 0:3c3d4c5ac8e9 14 float t0;
okano 0:3c3d4c5ac8e9 15 float t1;
okano 0:3c3d4c5ac8e9 16
okano 0:3c3d4c5ac8e9 17 i2c.frequency( 400 * 1000 );
okano 0:3c3d4c5ac8e9 18
okano 0:3c3d4c5ac8e9 19 while(1) {
okano 0:3c3d4c5ac8e9 20 t0 = temp0;
okano 0:3c3d4c5ac8e9 21 t1 = temp1;
okano 0:3c3d4c5ac8e9 22 printf( "temp = %7.3f, %7.3f\r\n", t0, t1 );
okano 0:3c3d4c5ac8e9 23 wait( 1 );
okano 0:3c3d4c5ac8e9 24 }
okano 0:3c3d4c5ac8e9 25 }