Skip to main content
Engineering LibreTexts

LIS3DH Triple-Axis Accelerometer

  • Page ID

    LIS3DH Triple-Axis Accelerometer.png

    LIS3DH Triple-Axis Accelerometer

    The python code below is based on code from the following page and uses the I2C connection.


    import time
    import board              # Import the needed libraries.
    import digitalio
    import adafruit_lis3dh
    i2c = board.I2C()         # Set up I2c communication.
    int1 = digitalio.DigitalInOut(board.D6)
    lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c, int1=int1)
    while (True):
      x, y, z = lis3dh.acceleration  # Get data for x, y, and z
      print("x,          y,        z")
      print(x, y, z)



    • Was this article helpful?