cancel
Showing results for 
Search instead for 
Did you mean: 

LSM303DLHC as outdoor thermometer

af.bulychev9
Associate II
Posted on December 11, 2013 at 08:06

I want to use lsm303dlhc as outdoor thermometer.

I use next code

      int8_t value= 25+data[0];

 

      uint8_t sign=value&0x80;

 

      uint8_t cels=0;

 

      if(sign)

 

          cels=(~value)+1;

 

      else

 

          cels=value;

but when temperature is minus i have value 11, it is wrong.

How can i use this right?
1 REPLY 1
Thiago REIS
Associate II
Posted on December 11, 2013 at 17:42

Hello Alexander,

Your logic seems to be right, have you had the chance on testing with another part?

Could you please also provide more details on the final application that you are developing?

The reason for that is because LSM303DLHC is not recommended for new designs, I would therefore suggest you to move with LSM303D.

Thank you,

Thiago Reis