LIS3DH on PyGamer using CircuitPython

This is a special forum devoted to educators using Adafruit and Arduino products for teaching.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
kramlichd
 
Posts: 2
Joined: Thu Oct 03, 2019 9:53 am

LIS3DH on PyGamer using CircuitPython

Post by kramlichd »

I am trying to access the accelerometer on the PyGamer with CircuitPython. The PyGamer pinout page doesn't specifically state how it is connected (i2c, spi). I tried accessing it with CircuitPython via I2C and I get a ValueError - No I2C device at address: 18. The code I am using is below. First, is the sensor wired for i2c or spi, if i2c, what would cause this error?

Thanks in advance for any help.

import time
import board
import digitalio
import adafruit_lis3dh
i2c = board.I2C()
int1 = digitalio.DigitalInOut(board.ACCELEROMETER_INTERRUPT)
lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c, int1=int1)

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: LIS3DH on PyGamer using CircuitPython

Post by adafruit_support_carter »

On the PyGamer, the LIS3DH uses the alternative address of 0x19 instead of the default 0x18. Try:

Code: Select all

lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19, int1=int1)

User avatar
kramlichd
 
Posts: 2
Joined: Thu Oct 03, 2019 9:53 am

Re: LIS3DH on PyGamer using CircuitPython

Post by kramlichd »

Thanks, that appears to work.

Locked
Please be positive and constructive with your questions and comments.

Return to “For Educators”