Problems about using I2C.h

Hello,

you have to understand how your slave works, so you need open and read datasheet of your slave device where you will probably see a description about serial i2c communication.

Usually it works like in this example (not real code)

int slaveaddress = 0x44<<1
char readBuffer[6]
char wrireBuffer[2];
data[0] = 0x01 // this represent a comand for read
data[1] = 0x05 // this represent an address of a register from where you want read
if(i2c.wrire(slaveAddress, wrireBuffer,sizeof(wrireBuffer))){
   thread_sleep_for(200); //small delay according to datasheet of your slave
   i2c.read(slaveAddress,readBuffer,sizeof(readBuffer));
   // here process and clean the readBuffer
}

I2C - API references and tutorials | Mbed OS 6 Documentation

BR, Jan