from machine import I2C, Pin
import ssd1306
import time
import mpu6050
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
oled_width = 128
oled_height = 64
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)
mpu = mpu6050.MPU6050(i2c)
mpu.wake()
while True:
gyro = mpu.read_gyro_data()
accel = mpu.read_accel_data()
temp = mpu.read_temperature()
oled.fill(0)
oled.text(str(int(gyro[0])) + " " + str(int(gyro[1])) + " " + " " + str(int(gyro[2])), 0, 2)
oled.text(f'{accel[0]:.2f} {accel[1]:.2f} {accel[2]:.2f}', 0, 20)
oled.text(f'{temp:.1f}', 0, 40)
oled.show()