hello, thanks for your answer, I tried to do that, but I couldnt write the code in its format.
I should communicate with more than one sht21 sensor, and since it gives a unique address (even if more than one sht21 sensor are connected to a single two wire i2c bus) i should use software i2c approachs.
I think that portssht21.cpp is defined in a wrong manner, but I have no knowledge of C++ programming (and a little in c programming)
Would you please help me?
Thanks for your guidance. but it seems that some people has done this without any external hardware, using (as I mentioned in first post) Jeelib library. But it always gives me -46.85 degree for temperature.
Would you please take a look at the submitted code in first post and source code of portssht21.cpp & portssht21.h code and guide me?
The SHT21 sensor is a 3V3 device. To use it on an UNO you need a bidirectional level converter. As you connected it to 5V you probably need to buy a new sensor. If you don't connect the sensor directly, then post the link to the board you're using as I requested earlier!
It's probably not a problem of the code although the code is quite an overkill for the task (it contains a lot of code you don't need and the pretty nontransparent usage of the digital and analog pins to form so called ports is at least unusual. But it seems to do what it claims to, at least I found no obvious bug.
Please explain, why an I2C muxer is not feasible for you. The software solution will fail if the chip uses clock stretching while the hardware acts correctly.
If you don't need more than 4 sensors take a look at the SHT31 alternative. It runs on 5V and has two address lines to select the I2C address (and it's more precise but slightly more expensive). That way you can eliminate the level converter and you don't need the clumsy software emulation or the bus muxer.
pylon:
The SHT21 sensor is a 3V3 device. To use it on an UNO you need a bidirectional level converter. As you connected it to 5V you probably need to buy a new sensor. If you don't connect the sensor directly, then post the link to the board you're using as I requested earlier!
The SHT21 module has a 3.3V regulator, so you can connect 5V to its Vin pin.