Pages: [1]   Go Down
Author Topic: Wire.requestFrom() hangs  (Read 1179 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hei,

Im tryng to read SHT25(http://www.sensirion.com/en/pdf/product_information/Datasheet-humidity-sensor-SHT25.pdf) sensor with my arduino UNO. Since SHT25 uses 3.3v i disabled arduino pullup resistors from Wire lib (in twi.c removed   digitalWrite(SDA, 1); and digitalWrite(SCL, 1)smiley-wink and use my own for 3.3v.

So now here's the code im running:
Code:
    Wire.beginTransmission(eSHT2xAddress); //begin
    Serial.println("begin done");
    Wire.write(command); //send the pointer location
    Serial.println("write done");
    delay(100);
    Wire.endTransmission();                //end
    Serial.println("end trans done");

    Wire.requestFrom(eSHT2xAddress, 3);
    Serial.println("request from done");
    while(Wire.available() < 3) {
      Serial.println("waiting"); //wait
    }

    //Store the result
    result = ((Wire.read()) << 8);
    result += Wire.read();
result &= ~0x0003;   // clear two low bits (status bits)

I added Serial.println() between the Wire calls to debug whats going on and the result is that program hangs on: Wire.requestFrom(eSHT2xAddress, 3);

Whats also strange is that sometimes it happens on the first run, sometimes it reads the temperature properly couple of times and then hangs.

Do anybody have some ideas what might be going wrong?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks like anybody else have'nt had problems with that. But maybe someone can answere and say if its a problem that arduino is running on 5V and my sensor on I2C is running on 3.3V?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Have you ever get this to work? I'm facing the same problem.
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Have you ever get this to work? I'm facing the same problem.

So post your full code which the OP hasn't.
Logged

Pages: [1]   Go Up
Jump to: