Description
(optional) Device-specific library
'''
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))
I2C is a communication protocol using 2 wires. Read more here and here.
SAM32 already has pull-up resistors on the SCL and SDA lines, so you don't need to add those
default pin names are:
board.SDA
board.SCL