warning: invalid conversion from 'int' to 'TwoWire*' [-fpermissive]

I’m developing a system with a BME280 sensor and an HTU21DF sensor, but have many questions on how I can make the 2 sensors work at the same time in the same code, with only 1 sensor it’s easy, but I am a beginner in the use of the I2C, my code is bellow, have the problem wrote in the description. And thanks for your time.

////////////////////////////////////////////////////////////

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include “Adafruit_HTU21DF.h”

Adafruit_BME280 bme;
Adafruit_HTU21DF htu = Adafruit_HTU21DF();

float temperatura=0;
float presion=0;
float humedad=0;

float temperaturaHtu=0;
float humedadHtu=0;

void setup()
{
Wire.begin();
Serial.begin(9600);
if (!bme.begin(0x76))
{ Serial.print(“No encuentro un sensor BME280 valido!”);
while (1);
if (!htu.begin(0x40))
{ Serial.println(“No encuentro un sensor BME280 valido!”);
while (1);
}
}
}
void loop()
{
temperatura = bme.readTemperature();
presion = bme.readPressure()/100;
humedad = bme.readHumidity();
temperaturaHtu = htu.readTemperature();
humedadHtu = htu.readHumidity();

Serial.print("Temeperatura: “);
Serial.print(temperatura);
Serial.print(“C”);
Serial.print(” ");
Serial.print("Presion: “);
Serial.print(presion);
Serial.print(“hPa”);
Serial.print(” “);
Serial.print(“Humedad: “);
Serial.print(humedad);
Serial.print(”%”);
Serial.print(” ");
Serial.print("Temeperatura interna: “);
Serial.print(temperaturaHtu);
Serial.println(“C”);
Serial.print(” ");
Serial.print(“Humedad interna : “);
Serial.print(humedadHtu);
Serial.println(”%”);

delay(500);
}

Hello, you may need to adapt the libraries.

See this comparison post, you may want to avoid using different sensors: https://www.kandrsmith.org/RJS/Misc/Hygrometers/calib_many.html

Connect two BME280 Sensors on the I2C bus: https://www.bluedot.space/tutorials/connect-two-bme280-on-i2c-bus/

void setup()
{
  Wire.begin();
  Serial.begin(9600);
  if (!bme.begin(0x76))
  { Serial.print("No encuentro un sensor BME280 valido!");
    while (1);
    if (!htu.begin(0x40))
    { Serial.println("No encuentro un sensor BME280 valido!");
      while (1);
    }
  }
}

You have the if statement with htu.being() nested within the if statement for bme.begin(), where it can never be executed because of the while (1).

htu.begin() does not take the I2C address as an argument, and in this case should not need any argument.

rtek1000: Hello, you may need to adapt the libraries.

See this comparison post, you may want to avoid using different sensors: https://www.kandrsmith.org/RJS/Misc/Hygrometers/calib_many.html

Connect two BME280 Sensors on the I2C bus: https://www.bluedot.space/tutorials/connect-two-bme280-on-i2c-bus/

Man, I really appreciate the information, was very useful, but this time I have to manage the project with different sensors, thanks for your time.

david_2018: void setup() {  Wire.begin();  Serial.begin(9600);  if (!bme.begin(0x76))  { Serial.print("No encuentro un sensor BME280 valido!");    while (1);    if (!htu.begin(0x40))    { Serial.println("No encuentro un sensor BME280 valido!");      while (1);    }  } }

You have the if statement with htu.being() nested within the if statement for bme.begin(), where it can never be executed because of the while (1).

htu.begin() does not take the I2C address as an argument, and in this case should not need any argument.

Bro, your guide was the solution, I really appreciate the collaboration, thanks for this.