From 7170399091385ee288ba055fdac1e548f428c1b2 Mon Sep 17 00:00:00 2001 From: Tangxiulin <11016272+ha-ha-earl@user.noreply.gitee.com> Date: Sat, 15 Mar 2025 17:08:07 +0800 Subject: [PATCH] =?UTF-8?q?wiki=20gpio=20=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- en/peripherals/machine.Pin.md | 29 +++++++++++------------------ zh/peripherals/machine.Pin.md | 28 ++++++++++------------------ 2 files changed, 21 insertions(+), 36 deletions(-) diff --git a/en/peripherals/machine.Pin.md b/en/peripherals/machine.Pin.md index 9fd8a7a..039ac88 100644 --- a/en/peripherals/machine.Pin.md +++ b/en/peripherals/machine.Pin.md @@ -29,24 +29,17 @@ gpio1.get_dir() ### `machine.Pin` -
-
-
class machine.Pin(GPIOn, direction, pullMode, level)
-
-

参数描述:

- -
-
+```python +class machine.Pin(GPIOn, direction, pullMode, level) +``` + +**Parameter:** + +- `GPIOn` - Integer type. GPIO number. Click here to view the mapping relationship between GPIO pin numbers and physical pins. +- `direction` - Integer type. I/O mode. `IN` - Input mode. `OUT` - Output mode. +- `pullMode` - Integer type. Pull selection mode. Descriptions are as follows:
PULL_DISABLE - Floating mode
PULL_PU - Pull-up mode
PULL_PD - Pull-down mode +- `level` - Integer type. Pin level. `0` - Set pin to low level. `1`- Set pin to high level. + **Example:** ```python diff --git a/zh/peripherals/machine.Pin.md b/zh/peripherals/machine.Pin.md index ee47878..bf45b41 100644 --- a/zh/peripherals/machine.Pin.md +++ b/zh/peripherals/machine.Pin.md @@ -29,24 +29,16 @@ gpio1.get_dir() ### `machine.Pin` -
-
-
class machine.Pin(GPIOn, direction, pullMode, level)
-
-

参数描述:

- -
-
+```python +class machine.Pin(GPIOn, direction, pullMode, level) +``` + +**参数描述:** + +- `GPIOn` - GPIO号,int类型,点此查看 GPIO引脚编号与物理引脚的映射关系。 +- `direction` - 输入输出模式,int类型,`IN` - 输入模式,`OUT` - 输出模式。 +- `pullMode` - 上下拉模式,int类型,说明如下:
PULL_DISABLE - 浮空模式
PULL_PU - 上拉模式
PULL_PD - 下拉模式 +- `level` - 引脚电平,int类型,`0` - 设置引脚为低电平, `1`- 设置引脚为高电平。 **示例:** -- Gitee