from machine import I2C, Pin
import ssd1306
from time import sleep
from imu import MPU6050
import time
x = None
y = None
str1 = None
i2cOLED=I2C(0, scl=Pin((17)), sda=Pin((16)))
oled_width = 128
oled_height = 64
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2cOLED)
i2cMPU6050=I2C(0, scl=Pin((17)), sda=Pin((16)))
imu = MPU6050(i2cMPU6050)
oled.fill(0)
oled.show()
oled.text('Hello', 0, 0)
oled.show()
while True:
time.sleep(1)
x = imu.accel.x
y = imu.accel.y
str1 = ''.join([str(x2) for x2 in ['X:', x, ', Y:', y]])
oled.fill(0)
oled.show()
oled.text(str1, 0, 20)
oled.show()
print(str1)
Loading
pi-pico-w
pi-pico-w
Loading
ssd1306
ssd1306