Skip to content

Expand Examples #12

Closed
Closed
@sommersoft

Description

@sommersoft
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)

Activity

evaherrada

evaherrada commented on Jun 18, 2020

@evaherrada
Collaborator

I'll take a look at doing this

self-assigned this
on Jun 18, 2020
linked a pull request that will close this issueAdded support for setting data rate #19on Jul 6, 2020
evaherrada

evaherrada commented on Jul 6, 2020

@evaherrada
Collaborator

#19 technically closed this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @kattni@sommersoft@evaherrada

    Issue actions

      Expand Examples · Issue #12 · adafruit/Adafruit_CircuitPython_L3GD20