[Modbus]
Description
Returns the data of the private array readData in the ModbusMasterNode class.
readData is the array stored after reading back to the Slave device registers using the Read function code.
Syntax
node1.receive()
Parameters
node1
: ModbusMasterNode object.
Returns
uint16_t: Return the data of the private array readData in the ModbusMasterNode class.
Example
#include <Modbus86.h> ModbusMaster bus1; ModbusMasterNode node1; uint8_t result; uint8_t j = 0; uint16_t data[6]; void setup() { while(!Serial); Serial1.begin(115200); bus1.begin(MODBUS_RTU, Serial1); node1.attach(16, bus1); result = node1.readHoldingRegisters(0, 6); if (result != MODBUS_SUCCESS) { Serial.print("readHoldingRegisters => ErrorCode: "); Serial.println(result); } else { Serial.print("From Holding Register receiveData: "); while(node1.available() > 0) { data[j++] = node1.receive(); Serial.println(data[j - 1]); } } } 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.