Chain BUS
API
ChainBUS
- class chain.chain.ChainBus(*args, **kwargs)
基类:
objectCreate a Chain bus instance.
- 参数:
UiFlow2 Code Block:

MicroPython Code Block:
from chain import ChainBus chainbus_0 = ChainBus(2, 32, 33, verbose=True)
- send(device_id, cmd, payload, timeout_ms)
Send custom command to device.
- 参数:
- 返回:
Response data.
- 返回类型:
UiFlow2 Code Block:

MicroPython Code Block:
chainbus_0.send(1, 0x20, b"ÿ", 3000)
- get_device_num()
Get connected device number.
- 返回:
Number of connected devices.
- 返回类型:
UiFlow2 Code Block:

MicroPython Code Block:
num = chainbus_0.get_device_num()
- deinit()
Deinitialize the Chain bus.