-
Notifications
You must be signed in to change notification settings - Fork 20
lis3dh_simpletest does not work for pygamer #52
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
Comments
this example works for the pygamer:
|
Put in a PR. I'd rather not have a separate
I'll let you decide how you'd like to do it, but a PR would certainly be appreciated! |
Why does the one case also have an explicit address set? How about moving the # configure interrupt pin
if hasattr(board, 'ACCELEROMETER_INTERRUPT'):
int1 = digitalio.DigitalInOut(board.ACCELEROMETER_INTERRUPT)
else:
int1 = digitalio.DigitalInOut(board.D6) # Set to correct pin for interrupt!
# configure I2C bus
if hasattr(board, 'ACCELEROMETER_SCL'):
i2c = busio.I2C(board.ACCELEROMETER_SCL, board.ACCELEROMETER_SDA)
else:
i2c = busio.I2C()
# create LIS3D object
lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19, int1=int1) |
The default address is 0x18 |
So the logic is trying to actually infer the specific board - CircuitPlaygroud, PyGamer, etc., so it can then also set the address as needed? This could become a fairly nasty logic blob to cover all possible combinations of I2C pin names, interrupt pin names, and addresses that might be used. For the sake of keeping this "simple", could just cover the majority case and have code comments that say "change pins if needed" and "change address if needed". So for PyGamer, user would need to edit code. |
Agreed! I’ll put in a PR this evening. I just wanted to document the difference |
The current lis3dh_simpletest example uses the existence of ACCELEROMETER_SCL to determine the pin configuration and I2C address
https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH/blob/master/examples/lis3dh_simpletest.py#L9
But this does not work for the pygamer. It has ACCELEROMETER_INTERRUPT but uses the default board SCL/SDA.
I'll be happy to put in a PR but wanted to see how you wanted to implement it or should there just be a separate lis3dh_pygamer_simpletest?
The text was updated successfully, but these errors were encountered: