MCP9808 I2C sensor temperature and Matlab

Based on a Matlab TMP102 tutorial I tried to use the lines for a MCP9808 I2C sensor temperature Grove sensor.

What should be the temperature equation as I can not find any information for it (I am using 2019a)?





clear;

aBoard = arduino(‘COM3’, ‘Uno’, ‘Libraries’, ‘I2C’);

addrs = scanI2CBus(aBoard)

tmpGroveSensor = device(aBoard,‘I2CAddress’,‘0x18’)

write(tmpGroveSensor, 0, ‘uint8’);

data = read(tmpGroveSensor, 2, ‘uint8’);

temperature = (double(bitshift(int16(data(1)), 4)) + double(bitshift(int16(data(2)), -4))) * 0.0625

Hi There



the image convey the meaning that ethir you should Convert binary to decimal for Centigrade