Hello, does anyone have an SHT31 I2C example? I copied the I2C (accelerometer) sample and updated the code for the SHT31 but not having any luck. I keep receiving a bad address error. The SHT31 evaluation board has the pull-up resistors on the I2C lines and works fine with an Arduino board.
static const uint8_t sht31Address = 0x44;
static const uint16_t sht31SingleHigh = 0x2400;
code within timer event routine:
transferredBytes = I2CMaster_Write(i2cFd, sht31Address, sht31SingleHigh, sizeof(sht31SingleHigh));
if (!CheckTransferSize(“I2CMaster_Write CMD_SINGLE_HIGH”, sizeof(sht31SingleHigh), transferredBytes)) {
exitCode = ExitCode_Sht31Timer_WriteTemperatureHumidity; // fails here
return;
}
usleep(20000);
uint8_t readData[6];
transferredBytes = I2CMaster_Read(i2cFd, sht31Address, &readData, sizeof(readData));
if (!CheckTransferSize("I2CMaster_Read CMD_SINGLE_HIGH", sizeof(readData), transferredBytes)) {
exitCode = ExitCode_Sht31Timer_ReadTemperatureHumidity;
return;
}
Code was uploaded here: https://github.com/egionet/I2C_SHT31_HighLevelApp