from machine import Pin, I2C
from time import sleep
import MPU6050
import math
i2c= I2C(0,sda=Pin(16),scl=Pin(17))
mpu= MPU6050.MPU6050(i2c)
mpu.wake()
while True:
accel = mpu.read_accel_data()
mag = math.sqrt(accel[0]**2 + accel[1]**2 + accel[2]**2)
print("x",accel[0],"y",accel[1], "z",accel[2])
print(f"Magnitud de la aceleración: {mag:.3f}g\n")
sleep(0.1)