import adafruit_lis3dh import board import busio import neopixel import time cadena = neopixel.NeoPixel(board.D8, 10, brightness=0.3) i2c = busio.I2C(board.ACCELEROMETER_SCL, board.ACCELEROMETER_SDA) lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c, address=25) lis3dh.range = adafruit_lis3dh.RANGE_2_G while True: x, y, z = lis3dh.acceleration print("X = ", x, " Y = ", y, " Z = ", z) cadena.fill((0, 0, 0)) if x > 4 and y < 4 and y > -4: cadena[6] = (255, 0, 0) cadena[8] = (255, 0, 0) if x < -4 and y < 4 and y > -4: cadena[1] = (255, 0, 0) cadena[3] = (255, 0, 0) if y > 4 and x < 4 and x > -4: cadena[0] = (255, 0, 0) cadena[9] = (255, 0, 0) if y < -4 and x < 4 and x > -4: cadena[4] = (255, 0, 0) cadena[5] = (255, 0, 0) time.sleep(0.5)