Skip to main content
Engineering LibreTexts

LIS3DH Triple-Axis Accelerometer

  • Page ID
    52404
  •  

    LIS3DH Triple-Axis Accelerometer.png

    LIS3DH Triple-Axis Accelerometer

    https://www.adafruit.com/product/2809

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

    https://learn.adafruit.com/adafruit-lis3dh-triple-axis-accelerometer-breakout/python-circuitpython

     

    #!/usr/bin/python3
    
    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)
      time.sleep(0.3)
    

     

     

    • Was this article helpful?