device.exists
device.exists
功能
判断系统中是否存在指定串口。
语法
device.exists(port)
参数
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| port | String | 否 | 无 | 串口名称。 |
返回值
| 类型 | 说明 |
|---|---|
| Bool | 存在返回 true;未传或不存在返回 false。 |
示例
result = device.exists('COM3') // 输出:Bool echo(type(result))
注意事项
- exists 会执行一次串口扫描。
判断系统中是否存在指定串口。
device.exists(port)
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| port | String | 否 | 无 | 串口名称。 |
| 类型 | 说明 |
|---|---|
| Bool | 存在返回 true;未传或不存在返回 false。 |
result = device.exists('COM3') // 输出:Bool echo(type(result))