# 导入相关模块
from pyb import ExtInt
from machine import I2C,Pin
from ssd1306 import SSD1306_I2C
# 初始化 OLED 模块
i2c = I2C(sda=Pin("Y8"), scl=Pin("Y6"))
oled = SSD1306_I2C(128, 64, i2c, addr=0x3c)
# OLED 初始信息显示
oled.fill(0) # 清屏背景黑色
oled.text("Human body test:", 0, 15) # 写入第1行内容
oled.show() # OLED 执行显示
def Display(): # Get People 闪烁5次效果!
for i in range(5):
oled.fill(0) # 清屏背景黑色
oled.text("Human body test:", 0, 15) # 写入第1行内容
oled.text("Get People!!!", 0, 40) # 写入第2行内容
oled.show( ) # OLED 执行显示
pyb.delay(500)
oled.fill(0) # 清屏背景黑色
oled.text("Human body test:", 0, 15) # 写入第1行内容
oled.text(“ ", 0, 40) # 写入第2行内容
oled.show( ) # OLED 执行显示
pyb.delay(500)
callback=lambda e: Display( ) # 回调函数指向Display()函数
#上升沿触发,打开上拉电阻
ext = ExtInt(Pin('Y11'), ExtInt.IRQ_RISING, Pin.PULL_UP, callback)
ESP32
于 2022-08-20 14:25:36 首次发布