hi.
I have a Adafuit HTU31 sensor and I try to plug the sensor in my Arduino UNO r4 wifi qwiik plug. the sensor receive power and the light turn on but no matter what I try to change in the code the sensor is not found by the UNO.
Thanks
That is the latest code i try.
#include <Wire.h>
#include "Adafruit_HTU31D.h"
Adafruit_HTU31D htu = Adafruit_HTU31D();
void setup() {
Serial.begin(115200);
// No need to wait for Serial in a deployed project
Serial.println("HTU31D Temperature Reader");
Wire.begin(); // Initialize I2C - UNO R4 WiFi Qwiic uses default SDA/SCL pins
if (!htu.begin(0x40)) {
Serial.println("Couldn't find HTU31D sensor!");
while (1) delay(10);
}
Serial.println("HTU31D found!");
}
void loop() {
sensors_event_t humidity, temp;
htu.getEvent(&humidity, &temp);
Serial.print("Temperature: ");
Serial.print(temp.temperature);
Serial.println(" °C");
delay(2000); // Read every 2 seconds
}