from machine import Pin, ADC, I2C
from utime import sleep, sleep_ms
from ssd1306 import SSD1306_I2C
from MPU6050 import MPU6050
ancho = 128
alto = 64
i2c = I2C(0, scl=Pin(9), sda=Pin(8))
oled = SSD1306_I2C(ancho, alto, i2c)
mpu = MPU6050(i2c)
print("Dirección:", i2c.scan())
while True:
tem = mpu.read_temperature()
gyro = mpu.read_gyro_data()
acel = mpu.read_accel_data()
#print(tem, gyro, acel)
print(acel[0], gyro[0])
sleep_ms(50)
oled.fill(0)
oled.hline(0,0,128,1)
oled.hline(0,20,128,1)
oled.vline(0,0,20,1)
oled.vline(127,0,20,1)
oled.text('Datos MPU6050 ', 10, 7, 1)
oled.text("Tem:{:.1f}c".format(tem),0, 30, 1 )
oled.show()