l3gd20_simpletest.py
1 import time 2 from board import SCL, SDA 3 import busio 4 import adafruit_l3gd20 5 6 # define the I2C wires 7 I2C = busio.I2C(SCL, SDA) 8 # initialize the device 9 SENSOR = adafruit_l3gd20.L3GD20_I2C(I2C) 10 11 while True: 12 13 print('Acceleration (m/s^2): {}'.format(SENSOR.acceleration)) 14 15 print() 16 17 time.sleep(1)