![](/media/cache/group/IMG_1289.JPG.50x50_q85.jpg)
A test program for LM75B temperature sensor
main.cpp
- Committer:
- Rhyme
- Date:
- 2017-04-24
- Revision:
- 1:3dff1e886346
- Parent:
- 0:7dd6fe5e908d
File content as of revision 1:3dff1e886346:
#include "mbed.h" #include "MSS.h" #include "LM75B.h" #define LM75B_I2C_ADDRESS (0x48) int main() { int8_t itemp = 0 ; float ftemp = 0.0 ; LM75B lm75b(PIN_SDA, PIN_SCL, LM75B_I2C_ADDRESS) ; printf("=== test LM75B for %s (%s) ===\n", BOARD_NAME, __DATE__) ; printf("Temperature (int) C, Temperature (float) C\n") ; while(1) { itemp = lm75b.temp() ; lm75b.getTemp(&ftemp) ; // printf("Temp = %d C degree, %.3f C degree\n", itemp, ftemp) ; printf("%4d, %4.3f\n", itemp, ftemp) ; wait(1) ; } }