Description

⚙ Hardware Needed


📚 External Libraries Needed


(optional) Device-specific library

📑 Code


'''
Prints accelerometer data from LSM9DS1 IMU device connected via I2C

M.Holliday 2019
'''

import time
import board
import busio
import adafruit_lsm9ds1

# I2C connection:
i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_lsm9ds1.LSM9DS1_I2C(i2c)

while True:
	x, y, z = sensor.acceleration
	print('x:{}, y:{}, z:{}'.format(x,y,z))

Details


I2C is a communication protocol using 2 wires. Read more here and here.