user46970: I'm a begginer with Arduino and this may be a basic question but I'm facing an issue.
I'm using a HTU21D sensor with an ESP32. This sensor use I2C communication. Inside the Arduino library, there is this function to start to collect data: 

//Start I2C communication
void HTU21D::begin(TwoWire &wirePort)
{
  _i2cPort = &wirePort; //Grab which port the user wants us to use

  _i2cPort->begin();
}

As you can see, we can set in this function which port we want to use. Perfect. But my probleme is that I don't know how to use the type TwoWire. I checked some documentation but I was still unable to find a solution. I want to use GPIO_16 as SDA and GPIO_17 as SCL. 
So I tried something like that without result: htu21d.begin(Wire(16, 17));
How to set SDA and SCL pin in TwoWire type ? (in my case GPIO_16 and GPIO_17) 

user58988: Here is the example of how you can change esp8266 i2c pins. I used it for my ESP8266 and bme280, but the same for Arduino and other sensors.
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

void setup() {
  Wire.pins(12,2); //new SDA SCL pins (D6 and D4 for esp8266)

  Serial.begin(115200);
  delay(100);

  bme.begin(0x76, &Wire); //here is the address for my bme280 and instance of TwoWire object
} 

For my ESP8266 I tried to use GPIO0 for SDA and GPIO2 for SCL, but no luck. Probably because GPIO0 is a Flash pin. Changing SDA to GPIO12 (or D6 pin) helped me.

user46970: I was able to resolve my issue thanks to Juraj comment. 
I did :
Wire.begin(16, 17);
htu21d.begin(Wire);


46970: <p>I'm a begginer with Arduino and this may be a basic question but I'm facing an issue.</p>

<p>I'm using a <a href="https://learn.sparkfun.com/tutorials/htu21d-humidity-sensor-hookup-guide" rel="nofollow noreferrer">HTU21D</a> sensor with an ESP32. This sensor use I2C communication. Inside the Arduino library, there is this function to start to collect data: 
</p>

<pre class="lang-cpp prettyprint-override"><code>//Start I2C communication
void HTU21D::begin(TwoWire &amp;wirePort)
{
  _i2cPort = &amp;wirePort; //Grab which port the user wants us to use

  _i2cPort-&gt;begin();
}
</code></pre>

<p>As you can see, we can set in this function which port we want to use. Perfect. But my probleme is that I don't know how to use the type TwoWire. I checked some documentation but I was still unable to find a solution. I want to use GPIO_16 as SDA and GPIO_17 as SCL. 
So I tried something like that without result: <code>htu21d.begin(Wire(16, 17));</code></p>

<p><strong>How to set SDA and SCL pin in TwoWire type ? (in my case GPIO_16 and GPIO_17)</strong> </p>
 58988: <p>Here is the example of how you can change esp8266 i2c pins. I used it for my ESP8266 and bme280, but the same for Arduino and other sensors.</p>

<pre><code>#include &lt;Wire.h&gt;
#include &lt;Adafruit_Sensor.h&gt;
#include &lt;Adafruit_BME280.h&gt;

void setup() {
  Wire.pins(12,2); //new SDA SCL pins (D6 and D4 for esp8266)

  Serial.begin(115200);
  delay(100);

  bme.begin(0x76, &amp;Wire); //here is the address for my bme280 and instance of TwoWire object
} 
</code></pre>

<p>For my ESP8266 I tried to use GPIO0 for SDA and GPIO2 for SCL, but no luck. Probably because GPIO0 is a Flash pin. Changing SDA to GPIO12 (or D6 pin) helped me.</p>
 46970: <p>I was able to resolve my issue thanks to Juraj comment. 
I did :</p>

<pre><code>Wire.begin(16, 17);
htu21d.begin(Wire);
</code></pre>
