begin()
Description
Initialize the ModbusMaster
object and assign it to the Serial class or the IPAddress class.
Syntax
bus1.begin(mode, serial) bus2.begin(mode, modbus_server_ip)
Parameters
bus1/bus2
: ModbusMaster
object.
mode
: Specifies the communication mode of the ModbusMaster
object. Its arguments are MODBUS_RTU
, MODBUS_ASCII
, or MODBUS_TCP
.
serial
: specifies the Serial class as the transmission channel.
modbus_server_ip
: specifies the IPAddress class as the transmission channel.
Return
bool
: If successful, return true
, otherwise return false
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
See Also
- ModbusMasterNode::attach()
- ModbusSlave::begin()
The text in the 86Duino reference is modified from the Arduino reference and is licensed under the Creative Commons Attribution-ShareAlike 3.0 License . The code examples in the reference have been released into the public domain.