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.
Dependents: LM75B-HelloWorld app-board-Sprint-SMS-LM75B SprintUSBModemWebsocketTest-Temp app-board-Ethernet-Websocket ... more
LM75B.cpp
00001 #include "LM75B.h" 00002 00003 LM75B::LM75B(PinName sda, PinName scl) : i2c(sda, scl) 00004 { 00005 char cmd[2]; 00006 cmd[0] = LM75B_Conf; 00007 cmd[1] = 0x0; 00008 i2c.write( LM75B_ADDR, cmd, 2); 00009 } 00010 00011 00012 00013 LM75B::~LM75B () 00014 { 00015 00016 } 00017 00018 float LM75B::read() 00019 { 00020 char cmd[2]; 00021 cmd[0] = LM75B_Temp; 00022 00023 i2c.write( LM75B_ADDR, cmd, 1); // Send command string 00024 i2c.read( LM75B_ADDR, cmd, 2); // Send command string 00025 return ( float((cmd[0]<<8)|cmd[1]) / 256.0 ); 00026 }
Generated on Tue Jul 12 2022 14:46:37 by
1.7.2