from machine import Pin, I2C
import ssd1306
# ESP32 Pin assignment
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
dout = Pin(2,Pin.IN)
sck = Pin(15,Pin.IN)
while True:
pres = dout.value() #读取压力传感器数据
time = sck.value() #读取时钟脉冲
print(pres)
print(time)
oled_width = 128
oled_height = 64
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)
oled.text(pres, 10, 10)
oled.show()
time.sleep(0.5)
Loading
ssd1306
ssd1306