This week I had to interface two accelerometers (adafruit MMA8451 breakout boards) into one Arduino board.
On Adafruits website, they write that you can address the sensors with 0x1C by adding a pull-down resistor on the “A” pin, or 0x1D by connecting the
“3Vo” to a 3V3 source. What they don’t tell is how to use them both at the same time, which gets clear once you take a look at the Adafruit_MMA8451 class within the library file Adafruit_MMA8451.h.
bool begin(uint8_t addr = MMA8451_DEFAULT_ADDRESS);
Here you have a simple code based on the library example, but adding the two sensors:
Thank you so much
This literally saved my life and my sanity