user32367: I want to use an Arduino Genuino Zero as a Modbus slave. I tried to search on google, and found a library. When I try using the library, I get a timeout error.
Can anyone tell me how to solve that error? Did anyone manage to get the Arduino Modbus RTU slave library working?

user32367: so i edited code your as below
    #define mySerial Serial1
byte test_data[8] = {0x01,0x03,0x00,0x64,0x00,0x02,0x85,0xD4};

int data_count = 5;


void setup() {

mySerial.begin(9600);
Serial.begin(9600);
delay(1000);

}
int count = 0; 
void loop() {

  if(count%10 == 0) {
    Serial.println();
    send_data();
  }

  count++;

  while(mySerial.available()>0)
  {
    byte b=mySerial.read();
    delay(1);
    Serial.print(b,HEX);
    Serial.print(" ");
  }
  //Serial.println(count);
  while(Serial.available())
  {

    byte a=Serial.read();
    delay(1);
    mySerial.print(a);

  }


  delay(1000);

}

void send_data() {
  Serial.println("send data");


  delay(1);
  for(char i=0;i<8;i++){
    mySerial.write(test_data[i]);
    delay(1);
    Serial.print(test_data[i],HEX);
    Serial.print(" ");
  }

  Serial.println();

  delay(1);


32367: <p>I want to use an Arduino Genuino Zero as a Modbus slave. I tried to search on google, and found <a href="https://www.dropbox.com/s/a277isxsxqurnpk/MODBUS.rar?dl=0" rel="nofollow noreferrer">a library</a>. When I try using the library, I get a timeout error.</p>

<p>Can anyone tell me how to solve that error? Did anyone manage to get the Arduino Modbus RTU slave library working?</p>
 32367: <p>so i edited code your as below
    #define mySerial Serial1</p>

<pre><code>byte test_data[8] = {0x01,0x03,0x00,0x64,0x00,0x02,0x85,0xD4};

int data_count = 5;


void setup() {

mySerial.begin(9600);
Serial.begin(9600);
delay(1000);

}
int count = 0; 
void loop() {

  if(count%10 == 0) {
    Serial.println();
    send_data();
  }

  count++;

  while(mySerial.available()&gt;0)
  {
    byte b=mySerial.read();
    delay(1);
    Serial.print(b,HEX);
    Serial.print(" ");
  }
  //Serial.println(count);
  while(Serial.available())
  {

    byte a=Serial.read();
    delay(1);
    mySerial.print(a);

  }


  delay(1000);

}

void send_data() {
  Serial.println("send data");


  delay(1);
  for(char i=0;i&lt;8;i++){
    mySerial.write(test_data[i]);
    delay(1);
    Serial.print(test_data[i],HEX);
    Serial.print(" ");
  }

  Serial.println();

  delay(1);
</code></pre>
