Black Lives Matter - Action and Equality. ... Adafruit joins the Stop Hate for Profit campaign.
0

adxl343 i2c address
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

adxl343 i2c address

by lavericklavericklaverick on Tue May 26, 2020 8:51 pm

Hi,

Im trying to use the adxl library with 2 ADXL343s.

I can pick them up with the i2c scanner at 1d and 53, however i cant find any documentation on how to address each sensor in the code.

I tried just sticking in the address instead of i2c and trying (i2c, 53) but it doesnt like it :(((((

If anyone has any advice id really appreciate it.

Thanks

Code: Select all | TOGGLE FULL SIZE
import time
import board
import busio
import adafruit_adxl34x

i2c = busio.I2C(board.SCL, board.SDA)

# For ADXL343
accelerometer = adafruit_adxl34x.ADXL343(i2c)
# accelerometer1 = adafruit_adxl34x.ADXL343(53)


while True:
    print("%f %f %f" % accelerometer.acceleration)
    time.sleep(0.2)

lavericklavericklaverick
 
Posts: 18
Joined: Mon May 06, 2019 6:58 pm

Re: adxl343 i2c address

by lavericklavericklaverick on Tue May 26, 2020 8:56 pm

sorted it, i realised that i need to use 0x infront of the address given on the printout ie 0x53

:)))

lavericklavericklaverick
 
Posts: 18
Joined: Mon May 06, 2019 6:58 pm

Re: adxl343 i2c address

by adafruit_support_bill on Wed May 27, 2020 5:14 am

Good to hear you resolved that. Thanks for the update.

adafruit_support_bill
 
Posts: 77819
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.