Library for the LM75A Temperature Sensor

Dependents:   LM75A_Test_Code MQTT_and_Temperature_Sensore_LM75 2021_Temp_y_Acelerom_V4enlace_serial

Files at this revision

API Documentation at this revision

Comitter:
edodm85
Date:
Fri Aug 15 11:56:39 2014 +0000
Parent:
0:94c821cb7f80
Commit message:
Fixed temp register

Changed in this revision

LM75A.cpp Show annotated file Show diff for this revision Revisions of this file
LM75A.h Show annotated file Show diff for this revision Revisions of this file
--- a/LM75A.cpp	Wed Jun 27 21:20:27 2012 +0000
+++ b/LM75A.cpp	Fri Aug 15 11:56:39 2014 +0000
@@ -26,7 +26,7 @@
 
 LM75A::LM75A(PinName sda, PinName scl, int addr) : m_i2c(sda, scl), m_addr(addr)
 {
-
+    reg_addr =  TEMP_REG_ADDR;
 }
 
 
@@ -40,7 +40,7 @@
 float LM75A::read_T()
 {
 
-  m_i2c.write(m_addr, TEMP_REG_ADDR, 1);                // Pointer to the temperature register
+  m_i2c.write(m_addr, &reg_addr, 1);                // Pointer to the temperature register
   char cmd[2] = {0,0};
   m_i2c.read(m_addr, cmd, 2);                           // read temperature register
   
--- a/LM75A.h	Wed Jun 27 21:20:27 2012 +0000
+++ b/LM75A.h	Fri Aug 15 11:56:39 2014 +0000
@@ -74,5 +74,6 @@
     private:
       I2C m_i2c;
       int m_addr;   
+      char reg_addr;
 };