ModbusMasterNode.sendBit()

[Modbus]

Description

Set the quotes in bits to the private array writeData in the ModbusMasterNode class and stack the data automatically with beginTransmission and writeMultipleCoils without parameters.

writeData is the contents of a Modbus packet using the Write function code.

Syntax

node1.sendBit(value)

Parameters

  • node1: ModbusMasterNode object.
  • value: Fill in the boolean value of the writeData array, which is the content of the Modbus packet to be sent.

Example

#include <Modbus86.h>
 
ModbusMaster bus1;
ModbusMasterNode node1;
 
uint8_t result;
 
void setup()
{
    while(!Serial);
    bus1.begin(MODBUS_RTU, Serial1);
    node1.attach(16, bus1); 
 
    node1.beginTransmission(5);
    node1.sendBit(true);
    node1.sendBit(false);
    result = node1.writeMultipleCoils();
 
    if (result != MODBUS_SUCCESS) {
        Serial.print("ErrorCode: ");
        Serial.println(result);
    }
}
 
void loop() {}

See Also


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.

Leave a Comment

Scroll to Top