[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() {}也可以看看
函式庫參考主頁面
86Duino 參考的文本是根據 知識共享署名-相同方式分享 3.0 許可證,部分文本是從 Arduino 參考 修改的。 參考中的代碼示例已發佈到公共領域。