adafruit / Adafruit_CircuitPython_ADXL34x

A CircuitPython driver for the ADXL34x family of accelerometers
MIT License
37 stars 14 forks source link

Setting range and rate #19

Closed jakobfriis closed 4 years ago

jakobfriis commented 4 years ago

I need a hint on how to set the range and rate, using this library.

import adafruit_adxl34x

i2c = busio.I2C(board.SCL, board.SDA) accelerometer = adafruit_adxl34x.ADXL345(i2c)

Using acceleromter.range(Range.RANGE_16_G) with yields the following error TypeError: 'int' object is not callable

Im probably using it wrong, but i cannot find any examples setting the range and data rate.

FoamyGuy commented 4 years ago

@jakobfriis try like this:

acceleromter.range = Range.RANGE_16_G

range is a property with a setter rather than being a function.

jakobfriis commented 4 years ago

Facepalming myself. Thanks for the help 👍👍