Chat here is you are connecting ESP-xx type modules to existing AVR based Arduino

Moderator: igrr

User avatar
By bernd331
#21086 Hi,

I try to connect the Lightintensity modul BH1750FVI to the ESP8266. Sadly until now, it will not work. I've connected SCL to GPIO5 and SCA to GPIO4. Pullup resistors to VCC also connected. I get only the value 54612.

I use the LIB from http://www.instructables.com/id/BH1750- ... /?ALLSTEPS. During compile there is no error.

Now the question: Which are the I2C pins? How to init I2C correctly? I think I use the wrong Pins? How can I define SCL and SCA Pins? I have also tryed to add the command Wire.pins(5,4); but then the compile says this command is deprecated.

Thanks in advance, Bernd

Edit: I added Wire.begin(); in the setup but no changes.
User avatar
By martinayotte
#21109 BTW, maybe it can help : several weeks ago, I posted that using alternate pins didn't work for me until I added the following code in the begin() function :
Code: Select all 
void TwoWire::begin(int sda, int scl){
+   default_sda_pin = sda;
+   default_scl_pin = scl;
    twi_init(sda, scl);
    flush();
  }

I didn't investigate further, but maybe the members are still keeping its previous values.