#include"mbed.h"

I2C tempsensor(P_9,P_10);//sda scl
Serial pc(USBTX, USBRX);//tx rx

const int addr = 0x90;
char config_t[3];
char temp_read[2];
float temp;

int main()
{
config_t[0] = 0X01;
config_t[1] = 0X60;
config_t[2] = 0XA0;
tempsensor.write(addr,config_t, 3);
config_t[0] = 0X00;
tempsensor.write(addr,config_t, 1);
while(1)
    {
     wait(1);
     tempsensor.read(addr,temp_read, 2);
     temp = 0.0625 * (((temp_read[0]<<8)+ temp_read[1])>> 4);
     pc.printf("Temp = %.2f  degC\n\r",temp);
    }
}
