#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)
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT