from machine import Pin, PWM, I2C, ADC
from ssd1306 import SSD1306_I2C
import framebuf
from imu import MPU6050
i2c = I2C(0, scl = Pin(17), sda = Pin(16), freq = 400000)
oled = SSD1306_I2C(128,64,i2c)
i2c2 = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
sensor = MPU6050(i2c2)
while True:
ax=round(sensor.accel.x,2)
ay=round(sensor.accel.y,2)
az=round(sensor.accel.z,2)
gx=round(sensor.gyro.x)
gy=round(sensor.gyro.y)
gz=round(sensor.gyro.z)
tem=round(sensor.temperature,2)
oled.fill(0)
oled.text("Ax: "+str(ax),0,0)
oled.text("Gx: "+str(gx),64,0)
oled.text("Ay: "+str(ay),0,16)
oled.text("Gy: "+str(gy),64,16)
oled.text("Az: "+str(az),0,32)
oled.text("Gz: "+str(gz),64,32)
oled.text("Tempeture: "+str(tem),0,48)
oled.show()