- Fri Jul 24, 2015 1:02 pm
#24171
certeza wrote:This piece of code works reliably for me on an ESP-12 with SDA on pin 4 and SCL on pin 5.
I changed the sketch to use pins 2 (SDA) and 0 (SCL) and got this output:
Code: Select allStarting up...
Looking for SI7021 sensor...
I2C device found at address 0x40 !
Humidity: 118.99
Temperature:
and then it hangs.
I also tried un-commenring the "reset" call in your code and got:
Code: Select allStarting up...
Looking for SI7021 sensor...
I2C device found at address 0x40 !
Device 0x40 reset.
Humidity: 118.99
Temperature:
and then it hangs.
Swapping the reads of temp and humitity over:
Code: Select allStarting up...
Looking for SI7021 sensor...
I2C device found at address 0x40 !
Device 0x40 reset.
Temperature: 128.86
Humidity:
... and hangs.
I tried swapping the SCL and SDA lines over and using "Wire.begin(0,2);". Same result.
So, just to prove the sensor is working, I transfer it to a Nano 3 and change the sketch from "Wire.begin(2,0);" to "Wire.begin();" and immediately it works:
Code: Select allStarting up...
Looking for SI7021 sensor...
I2C device found at address 0x40 !
Device 0x40 reset.
Temperature: 26.24
Humidity: 41.08
done
Can someone please scrutinise my pictures above. Have I wired everything correctly?