B4J Code Snippet MCP9808 reading temperature

Hello everyone,

Here an example for using the MCP9808 sensor on a raspberry pi.
This is only a code snippet, as it only read's the temperature.
Not all the registers are implemented.
Negative values aren't yet tested.

This is a console application.

Kind regards,
Tim.

*IMPORTANT UPDATE*
The conversion from previous version was not correct.
Java uses signed values, as the values to be calculated must be unsigned.
Here the new adjusted version. Negative values aren't tested yet.
*******************

*IMPORTANT UPDATE 2*
Latest version updatet for negative temperature measurement (tested)
********************
 

Attachments

  • MCP9808_CONSOLE.zip
    83.4 KB · Views: 295
Last edited:
Top