Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accepting the Si7021 sensor in the begin as programmatically compatible with HTU21D #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Adafruit_HTU21DF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ boolean Adafruit_HTU21DF::begin(void)
Wire.write(HTU21DF_READREG);
Wire.endTransmission();
Wire.requestFrom(HTU21DF_I2CADDR, 1);
return (Wire.read() == 0x2); // after reset should be 0x2
uint8_t result = Wire.read();
// after reset the result should be 0x2 for HTU21DF
// or 0x3A for Si7021, which is compatible for temp and humidity readings
return (result == 0x2) || (result == 0x3A);
}

/**
Expand Down