Hello, I am pretty much a beginner when it comes to Arduino, so let me know if I posted in the wrong forum section. Anyways, I am trying to get temperature data from a grove-i2c-high-accuracy-temperature-humidity-sensor-sht35 and I am using an Arduino Uno. Unfortunately, I do not have the base hat which interfaces with the Arduino. Instead I have wires and a bread board to connect ground, 5v, SCL, and SDA respectively. Below I have posted the code I am using to try to collect data from the system, but it keeps returning -1. I am unsure what this means and have been having trouble finding where I went wrong. Any help would be appreciated. Thank you!
#include <Wire.h>
int TempAddress = 0x45;//Temperature Sensor Address
#define PowerRegister 0x2D
int X0;
void setup() {
Wire.begin();
Serial.begin(9600);
delay(100);
Wire.beginTransmission(TempAddress);
Wire.write(PowerRegister);
Wire.write(8 );
Wire.endTransmission();
}
void loop() {
Wire.beginTransmission(TempAddress);
Wire.write(TempAddress);
Wire.endTransmission();
Wire.requestFrom(TempAddress,2); // Request the transmitted two bytes from the two registers
if(Wire.available()<=2) { //
X0 = Wire.read(); // Reads the data from the register
}
Serial.print("X0= ");
Serial.print(X0);
}