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.
Diff: main.cpp
- Revision:
- 2:edd678dcf504
- Parent:
- 0:3c3d4c5ac8e9
diff -r 5398b0799e20 -r edd678dcf504 main.cpp
--- a/main.cpp Fri Feb 27 12:35:30 2015 +0000
+++ b/main.cpp Thu Mar 05 06:15:11 2015 +0000
@@ -1,25 +1,16 @@
-/** Hello code for "test_LM75B" */
+/** Hello code for "PCT2075" and "LM75B" */
#include "mbed.h"
#include "PCT2075.h"
-
-PCT2075 temp0( p28, p27 );
+//#include "LM75B.h"
-I2C i2c( p28, p27 );
-PCT2075 temp1( i2c );
-
+PCT2075 temp_sensor( p28, p27 );
+//LM75B temp_sensor( p28, p27 );
int main()
{
- float t0;
- float t1;
-
- i2c.frequency( 400 * 1000 );
-
while(1) {
- t0 = temp0;
- t1 = temp1;
- printf( "temp = %7.3f, %7.3f\r\n", t0, t1 );
+ printf( "temp = %7.3f\r\n", (float)temp_sensor );
wait( 1 );
}
}