ModbusMasterNode.sendBit()

[Modbus]

説明

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

86Duino のリファレンスのテキストは Arduino レファレンス を編集したもので、 Creative Commons Attribution-ShareAlike 3.0 License下でライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。

コメントする

上部へスクロール