按键 =================== .. figure:: /_static/products/ledong-module/static/图片/按键-B.png :width: 55% :align: center 概述 -------------------- 按压式的开关数字输入模块,按下为高电平输出,释放为低电平输出。 技术参数 ------------------- 工作电压: VCC 3.3V -5V 模块尺寸:24*48mm 固定安装:2个兼容塑料积木通孔 数据类型:按下--1 松开--0 引脚定义 ------------------- ===== ======== 引脚 定义 ===== ======== GND 地 VCC 电源 DO 数字输出 NC 空 ===== ======== 示例程序 ------------------- **图形化代码** .. figure:: /_static/products/ledong-module/static/examples/按键.png :width: 100% :align: center .. code-block:: python T = None from mpython import * p0 = MPythonPin(0, PinMode.IN) def boolean_P0(): return p0.read_digital() == 1 T = 0 while True: if boolean_P0(): T = T + 1 oled.fill(0) oled.DispChar(str(str('按下次数: ') + str((str(T)))), 0, 0, 1) oled.show() .. figure:: /_static/products/ledong-module/static/examples/按键1.png :width: 100% :align: center