[Modbus]
描述
Set the timeout.
語法
gateway.setTimeout(timeout)
參數
gateway: ModbusGateway object.timeout: Set the timeout time in milliseconds. During the poll phase, if the timeout expires, the EXCEPTION_CODE will be returned to the Modbus Master.
範例
#include <Modbus86.h>
#include <Ethernet.h>
ModbusMaster bus;
ModbusMasterNode node1;
ModbusMasterNode node2;
ModbusGateway gateway;
void setup()
{
Ethernet.begin();
Serial485.begin(115200);
gateway.begin(MODBUS_TCP);
bus.begin(MODBUS_RTU, Serial485);
node1.attach(11, bus);
node2.attach(12, bus);
gateway.connect(node1);
gateway.connect(node2);
gateway.setTimeout(500);
}
void loop()
{
gateway.poll();
}也可以看看
函式庫參考主頁面
86Duino 參考的文本是根據 知識共享署名-相同方式分享 3.0 許可證,部分文本是從 Arduino 參考 修改的。 參考中的代碼示例已發佈到公共領域。