ArduinoModbus - client.requestFrom()

Description

Read multiple coils, discrete inputs, holding registers, or input register values. Use available() and read() to process the read values.

Syntax

int requestFrom(int type, int address, int nb);
int requestFrom(int id, int type, int address,int nb);

Parameters

  • id (slave) - id of target, defaults to 0x00 if not specified
  • type - type of read to perform, either
    • COILS (FC 0x01)
    • DISCRETE_INPUTS (FC 0x02)
    • HOLDING_REGISTERS (FC 0x03)
    • INPUT_REGISTERS (FC 0x04)
  • address start address to use for operation
  • nb - number of values to read

Returns

0 on failure, number of values read on success