Hello, I have been trying to fix this for days. I am using an ARDUINO MEGA 2560 in pair with a SH1x to record temperature and relative humidity. I have attached my code, picture of boar layout and my results. Any help would be appreciated.
_11111.ino (958 Bytes)

picture of boar layout
Nope.
The negative humidity values indicate a communication problem between your board and the sensor.
I presume that the sensor is on a module board or shield. Can you post a data sheet for the module?
Not a single bit of code with digital input work in the slightest. I have since tried using analog inputs instead and got it working perfectly. After about 3 hours, my sensor started showing data errors ( -40 degrees C and -4 percent RH). I am attaching my new code, board layout, and the datasheet of my SHT sensor.

Sensirion_Humidity_Sensors_SHT1x_Datasheet_V5.pdf (350 KB)
Temperaure_humidty_Sensor_Finished.ino (1.8 KB)