Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using two ADXL345's #43

Closed
jlboygenius opened this issue Aug 17, 2013 · 1 comment
Closed

Using two ADXL345's #43

jlboygenius opened this issue Aug 17, 2013 · 1 comment

Comments

@jlboygenius
Copy link

Looks like the library is hard coded to use 0x53, but documentation says you can use 2 of them..
Can this be passed as a variable during initialization rather than hard coded?

@jrowberg
Copy link
Owner

Hi @jlboygenius,

The class constructor does take an optional argument for the slave address. In ADXL345.h, you'll find the following lines:

#define ADXL345_ADDRESS_ALT_LOW     0x53 // alt address pin low (GND)
#define ADXL345_ADDRESS_ALT_HIGH    0x1D // alt address pin high (VCC)
#define ADXL345_DEFAULT_ADDRESS     ADXL345_ADDRESS_ALT_LOW

So you can actually instantiate the object like this:

ADXL345 accel(ADXL345_ADDRESS_ALT_HIGH);

...or simply:

ADXL345 accel(0x1D);

...and it should work that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants