[Modbus]
説明
Create a link between this gateway and the ModbusMasterNode object, which will correspond to a channel and node number.
構文
gateway.connect(node)
媒介変数
gateway: ModbusGateway object.node: ModbusMasterNode object, the object will correspond to a channel and node number.
戻り値
bool: Returns true if successful, false if not.
例
#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);
}
void loop()
{
gateway.poll();
}See Also
ライブラリリファレンスホーム
86Duinoリファレンスのテキストは、Arduinoリファレンスを改変したもので、Creative Commons Attribution-ShareAlike 3.0ライセンスに基づいてライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。