[Modbus]
Description
Initialize the ModbusGateway object and specify the communication mode between this object and the Modbus Master.
Syntax
gateway1.begin(mode, serial)
gateway2.begin(mode)
Parameters
gateway1/gateway2: ModbusGateway object.mode: Specify the communication mode between the ModbusGateway object and the Modbus Master with MODBUS_RTU, MODBUS_ASCII or MODBUS_TCP quotes.serial: Specify the Serial class as the transmission channel.
Returns
bool: Returns true if successful, false if not
Example
#include <Modbus86.h>
#include <Ethernet.h>
ModbusGateway gateway1;
ModbusGateway gateway2;
void setup()
{
Serial485.begin(115200);
gateway1.begin(MODBUS_RTU, Serial485);
Ethernet.begin();
gateway2.begin(MODBUS_TCP);
}
void loop()
{
}Libraries Reference Home
The text of the 86Duino reference is a modification of the Arduino reference and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.



