Chain BUS
Chain BUS is a communication bus module that allows multiple devices to connect and communicate with each other in the M5Chain series devices.
API
ChainBUS
- class chain.chain.ChainBus(id, tx, rx, verbose=False)
Bases:
objectCreate a Chain bus instance.
- Parameters:
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.
- Parameters:
- Returns:
Response data.
- Return type:
UiFlow2 Code Block:

MicroPython Code Block:
chainbus_0.send(1, 0x20, b"ÿ", 3000)
- get_device_num(timeout_ms=3000, retries=3)
Get connected device number.
UiFlow2 Code Block:

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