# serial.read_bytes ## 功能 从已打开串口读取原始字节,并返回 Bytes。 ## 语法 ```bt device.open(config).read_bytes() ``` ## 参数 无参数。 ## 返回值 | 类型 | 说明 | |------|------| | Bytes | 当前读取到的原始字节;没有数据时返回空 Bytes。 | ## 代码示例 ```bt port = device.open({type: 'serial', port: 'COM3'}) data = port.read_bytes() // 输出:Bytes print type(data) ``` ## 注意事项 - 串口读取受 `device.open({timeout: ...})` 控制。 - 返回值长度受 `BT_BYTES_LIMIT` 限制。