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

Expand Examples #12

Closed
sommersoft opened this issue Apr 6, 2019 · 2 comments · Fixed by #19
Closed

Expand Examples #12

sommersoft opened this issue Apr 6, 2019 · 2 comments · Fixed by #19
Assignees
Labels

Comments

@sommersoft
Copy link
Collaborator

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)
@sommersoft sommersoft added the good first issue Good for newcomers label Apr 6, 2019
@evaherrada
Copy link
Collaborator

I'll take a look at doing this

@evaherrada evaherrada self-assigned this Jun 18, 2020
@evaherrada evaherrada linked a pull request Jul 6, 2020 that will close this issue
@evaherrada
Copy link
Collaborator

#19 technically closed this

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

Successfully merging a pull request may close this issue.

3 participants