Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: UniGraphic mbed vt100
LM75B Class Reference
NXP LM75B Digital temperature sensor and thermal watchdog. More...
#include <LM75B.h>
Public Member Functions | |
| LM75B (I2C *i2c, int addr) | |
| LM75B constructor. | |
| ~LM75B () | |
| LM75B destructor. | |
| int | temp (int8_t *temp) |
| get temperature as one byte (signed) | |
| int | getTemp (float *temp) |
| get temperature as 11 bit (float) | |
| int | getConfig (uint8_t ptr_byte, uint8_t *config_data) |
| get configuration register | |
| int | setConfig (uint8_t ptr_byte, uint8_t config_data) |
| set configuration register | |
Detailed Description
NXP LM75B Digital temperature sensor and thermal watchdog.
#include "mbed.h" #include "LM75B.h" #define LM75B_I2C_ADDRESS (0x48) #if defined (TARGET_KL25Z) #define PIN_SCL PTE1 #define PIN_SDA PTE0 #elif defined (TARGET_KL46Z) #define PIN_SCL PTE1 #define PIN_SDA PTE0 #elif defined (TARGET_K64F) #define PIN_SCL PTE24 #define PIN_SDA PTE25 #elif defined (TARGET_K22F) #define PIN_SCL PTE1 #define PIN_SDA PTE0 #elif defined (TARGET_KL05Z) #define PIN_SCL PTB3 #define PIN_SDA PTB4 #elif defined (TARGET_NUCLEO_F411RE) #define PIN_SCL PB_8 #define PIN_SDA PB_9 #else #error TARGET NOT DEFINED #endif int main() { int8_t itemp = 0 ; float ftemp = 0.0 ; LM75B lm75b(PIN_SDA, PIN_SCL, LM75B_I2C_ADDRESS) ; while(1) { itemp = lm75b.temp() ; lm75b.getTemp(&ftemp) ; printf("Temp = %d C degree, %.3f C degree\n", itemp, ftemp) ; wait(1) ; } }
Definition at line 50 of file LM75B.h.
Constructor & Destructor Documentation
| LM75B | ( | I2C * | i2c, |
| int | addr | ||
| ) |
Member Function Documentation
| int getConfig | ( | uint8_t | ptr_byte, |
| uint8_t * | config_data | ||
| ) |
| int getTemp | ( | float * | temp ) |
| int setConfig | ( | uint8_t | ptr_byte, |
| uint8_t | config_data | ||
| ) |
Generated on Fri Jul 15 2022 06:01:07 by
1.7.2