Closed
Description
While assisting a user on Discord, it became apparent that the examples for this could be better. I suggest:
- Update the simpletest to include an example of how to use the different range settings. RTD and the example don't readily explain that using
L3DS20_RANGE_nnnn
requires proper namespace use. This can be foreign to Python beginners. Example:
import board
import busio
import adafruit_l3gd20
# Hardware I2C setup:
I2C = busio.I2C(board.SCL, board.SDA)
SENSOR = adafruit_l3gd20.L3GD20_I2C(I2C, rng=adafruit_l3gd20.L3DS20_RANGE_2000DPS)
- Add an example for how to use
write_register(address, value)
if you want to update registers that are instantiated with the defaults by the library. There are no callable methods to update registers, I assume to keep the library size small. Example:
import board
import busio
import adafruit_l3gd20
# Hardware I2C setup:
I2C = busio.I2C(board.SCL, board.SDA)
SENSOR = adafruit_l3gd20.L3GD20_I2C(I2C, rng=adafruit_l3gd20.L3DS20_RANGE_2000DPS)
# update the chip's register 0x20 with the value 0xBF
SENSOR.write_register(0x20, 0xBF)
Activity
evaherrada commentedon Jun 18, 2020
I'll take a look at doing this
evaherrada commentedon Jul 6, 2020
#19 technically closed this