Module uart
串口操作
Functions
| UART:close () | 关闭 |
| UART:write (data) | 写入 |
| UART:read () | 读取 |
| UART:on_data (cb) | 注册回调 |
| iot.uart (id, opts) | 创建UART对象 |
Functions
- UART:close ()
- 关闭
- UART:write (data)
-
写入
Parameters:
- data string 数据
Returns:
-
boolean 成功与否
- UART:read ()
-
读取
Returns:
- boolean 成功与否
- string 数据
- UART:on_data (cb)
-
注册回调
Parameters:
- cb
Returns:
-
function 数据回调
- iot.uart (id, opts)
-
创建UART对象
Parameters:
- id integer
- opts table 参数 {band_rate, data_bits, stop_bits, parity, rs485_gpio, rs485_level, rs485_delay}
Returns:
- boolean 成功与否
- UART