Hi everyone,
it's my first time with an Arduino-like device and I'm currently trying to connect an Imu BMX160 to the board in two different by from the default one, but i'm having a problem: I know that the Esp32 is able to use almost any pin for I2C as they show in this site in which they use an Adafruit sensor https://www.electrorules.com/esp32-i2c-communication-set-pinsmultiple-bus-interfaces-and-peripherals-arduino-ide/
But I don't know why it doesnt work with the one that I have. The code that I am using is the example, so I've tried to modify that like this
*/
#include <DFRobot_BMX160.h>
#include <Wire.h>
#define I2C_SDA 25
#define I2C_SCL 26
TwoWire I2C = TwoWire(0);
DFRobot_BMX160 bmx160;
void setup(){
I2C.begin(I2C_SDA, I2C_SCL);
bmx160.begin(&TwoWire);
Serial.begin(115200);
delay(100);
//init the hardware bmx160
if (bmx160.begin(&TwoWire) != true){
Serial.println("not found");
while(1);
}
But obviously it doesn't work because the function .begin in the library doesn't ask for a variable that define the position and instead it's in the constructor
class DFRobot_BMX160{
public:
DFRobot_BMX160(TwoWire *pWire=&Wire);
/**
* @fn begin
* @brief set the i2c addr and init the i2c.
* @return returns the initialization status
* @retval true Initialization succeeded
* @retval false Initialization failed
*/
bool begin();
...
So my question is, how can I manage to change that?
Thanks in advance