#import useful libraries
from imu import MPU6050
from time import sleep
from machine import Pin, I2C
#initialise variables
i2c = I2C(1, sda=Pin(14), scl=Pin(15), freq=400000)
imu = MPU6050(i2c)
#get the initial x rotational value
gx=imu.gyro.x
#main control loop
while True:
if(gx!=imu.gyro.x):
print(imu.gyro.x-gx, "degrees rotation change detected around the x-axis")
gx=imu.gyro.x
sleep(0.1)