| 12345678910111213141516171819202122 |
- from nbus_hal.serial_port import *
- # example config
- config = {
- "port_name": "COM4",
- "baud": 115200,
- "parity": "N",
- "timeout": 0.4,
- "request_attempts": 1,
- "enable_log": True
- }
- if __name__ == "__main__":
- try:
- port = NBusSerialPort(NBusSerialConfig(**config))
- port.set_logger(default_logger)
- response = port.request(5, 1, NBusCommand.CMD_ECHO, [1, 2, 3])
- print(response)
- except Exception as Ex:
- print(str(Ex))
|