First, make sure that you are using the latest image available and the latest IDE. Make sure you are powering both the board and the sensor with proper values. Use a different power supply for the sensor. Also remember that to use I2C you need to use pull up resistors. Look at this guide Pull-up Resistors - learn.sparkfun.com for more info on pull up resistors.
Also, I don’t think that the issue is with the Wire library, it works well on the Galileo. Take a look at HTU21D Humidity Sensor Hookup Guide - learn.sparkfun.com and make sure you’ve followed all suggestions.
Thanks for the reply. I'm using the latest image and IDE. Also, the sensor breakout has pullup resitors so I don't think I need to add any.
I read somewhere else (Looking for I2C example) that the Wire library can only use the A4 and A5 pins for I2C so it will ignore the Galileo's labelled SDA and SCL pins. Unfortunately, I can't use the A4 and A5 pins because I need all the analogue imputs for other sensors. Also, as I mentioned, I already tried using the A4 and A5 pins but they didn't work. Is there any way I can communicate over I2C in an Arduino sketch without using the Wire library?
I did some tests using a logic analyzer. When I uploaded a sketch that used A4 and A5 that same signal is repeated in SCL and SDA. This sketch sends I2C data. Take a look at picture 1. This test was made connecting the logic analyzer to A4, A5, SCL and SDA.
I also tried using a couple of potentiometers. This time in our sketch we used the analogRead function. One potentiometer was connected to A4 and the other one to A5. So we ran the logic analyzer and moved the potentiometer to see if the result would also be duplicated in the SCL and SDA pins. This sketch was not using the Wire library. This means that the signals shown in A4 and A5 are the same that show SCL and SDA.
As a last test I did a sketch that used both analog and I2C data. The sketch was using the Wire library. When I took the samples with the logic analyzer I got the following graphic.
As you can see, the signal is not as in the last images. The galileo tries to switch its muxing from I2C and the analog but it didn’t do any of those correctly as you can see in the graphic. This is because according to the schematic the mux reads an analog data but it is not able to send I2C simultaneously so it switches between analog and I2C producing a wrong output.
According to this, the behavior of these signals is not because of the wire library but because of the hardware of the board itself. In this case the I2C signal share the same mux as A4 and A5. Even though you use a different library you will still see these results.