MSS
/
testLM75B
A test program for LM75B temperature sensor
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "MSS.h" 00003 #include "LM75B.h" 00004 #define LM75B_I2C_ADDRESS (0x48) 00005 00006 int main() { 00007 int8_t itemp = 0 ; 00008 float ftemp = 0.0 ; 00009 LM75B lm75b(PIN_SDA, PIN_SCL, LM75B_I2C_ADDRESS) ; 00010 00011 printf("=== test LM75B for %s (%s) ===\n", BOARD_NAME, __DATE__) ; 00012 printf("Temperature (int) C, Temperature (float) C\n") ; 00013 00014 while(1) { 00015 itemp = lm75b.temp() ; 00016 lm75b.getTemp(&ftemp) ; 00017 // printf("Temp = %d C degree, %.3f C degree\n", itemp, ftemp) ; 00018 printf("%4d, %4.3f\n", itemp, ftemp) ; 00019 wait(1) ; 00020 } 00021 }
Generated on Thu Jul 14 2022 03:48:24 by 1.7.2