Boss lady
Boss lady
DIIDevHeads IoT Integration Server
Created by Boss lady on 7/2/2024 in #firmware-and-baremetal
How can I read data from an I2C temperature sensor (TMP102) using an STM32 microcontroller?
Good day guys, how can I read data from an I2C temperature sensor (TMP102) using an STM32 microcontroller? I am encountering the error Failed to read from the I2C bus: Remote I/O error despite confirming that the sensor is powered and the I2C connections are correctly set up. Here is my current code snippet, which attempts to read 10 bytes of data from the sensor:
char buffer[10];
if (read(file, buffer, 10) != 10) {
perror("Failed to read from the I2C bus");
}
char buffer[10];
if (read(file, buffer, 10) != 10) {
perror("Failed to read from the I2C bus");
}
@Middleware & OS @Helper
6 replies