![]() ![]() Note: I'm unsure about the line result |=61440 in the original code. ![]() But the sensor is in 12 bit mode at power up anyway and your code does not configure it otherwise. In that case you would have to ignore the corresponding lowest bits. Please note, that for this to work, you should not configure the sensor to less resolution. So you get the full precision of the sensor (12 bits). ((data&0x8)>3) and it's siblings will be 1, when the corresponding bit is set, and 0, if not. Then I add this up with the values of the lowest 4 bits. So I calculate first the number of whole degrees analog the your code. You can convert the received value per hand to float by also using this. The author from the link then shifts this data 4 bits to the right, so that all bits representing values under 1 vanish.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |