-1

an ADXL345 and IMU9252 are connected to an arduino pro mini through i2c bus. both modules have different addresses.
so i should change i2c address in slave(arduino) continuously to access both modules data.
I need to know how is it possible and if there is any standard solution to manage this situation?

P.S: I'm using RTimulib for mpu9252 and sparkfun for ADXL345.
so i should adopt the solution regarding to these libraries.

alex
  • 7,551
  • 13
  • 48
  • 80
  • If you are using libraries to drive the modules, those libraries should handle setting the I2C address when required. What actual problems are you having? – jfowkes Sep 19 '18 at 08:37

1 Answers1

0

Assuming you are using the standard Arduino Wire library, you need to use beginTransmission to begin an I2C transaction:

Wire.beginTransmission(address)

Just put the correct device address as the argument to that function.

jfowkes
  • 1,495
  • 9
  • 17