modbus library and suggestion

Hello everyone. I need help.I work this code but ı get library error.How I can obtain ModbusRtu library and I make communication with rs485 shield arduino.I wait suggestions.Thankss..


/**

  • Modbus slave example 3:
  • The purpose of this example is to link a data array
  • from the Arduino to an external device through RS485.
  • Recommended Modbus Master: QModbus
  • http://qmodbus.sourceforge.net/
    */

#include <ModbusRtu.h>

// assign the Arduino pin that must be connected to RE-DE RS485 transceiver
#define TXEN 2

// data array for modbus network sharing
uint16_t au16data[16] = {
3, 1415, 9265, 4, 2, 7182, 28182, 8, 0, 0, 0, 0, 0, 0, 1, -1 };

/**

  • Modbus object declaration
  • u8id : node id = 0 for master, = 1..247 for slave
  • u8serno : serial port (use 0 for Serial)
  • u8txenpin : 0 for RS-232 and USB-FTDI
  • or any pin number > 1 for RS-485
    */
    Modbus slave(1,0,TXEN); // this is slave @1 and RS-485

void setup() {
slave.begin( 19200 ); // baud-rate at 19200
}

void loop() {
slave.poll( au16data, 16 );
}

You at least made a try at using code tags but didn't quite get it. In the future you might use the "Preview" button to check how your forum markup worked until you get it all figured out.

When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here USING CODE TAGS (</> button on the toolbar).

Did you download the QModbus master as indicated in the comments for the slave code you posted?

What Arduino model are you using? Please provide links to the hardware you use (RS-485 module).