[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.
構文
node1.sendBit(value)
媒介変数
node1: ModbusMasterNode object.value: Fill in the boolean value of the writeData array, which is the content of the Modbus packet to be sent.
例
#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
ライブラリリファレンスホーム
86Duinoリファレンスのテキストは、Arduinoリファレンスを改変したもので、Creative Commons Attribution-ShareAlike 3.0ライセンスに基づいてライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。