Programmation Modbus RS485 RTU

Bonjour,

Je débute actuellement avec la programmation Arduino, je suis actuellement sur un projet utilisant la notion de MODBUS avec le composant RS485. Cependant je n'arrive pas a comprendre comment programmer ce type de communication. Mon ordinateur étant le maitre et la carte arduino étant l'esclave.
J'aimerais commencer juste sur une communication basique de réception ou non de message par ma carte (comme allumer la led via RS485). Plus tard je devrais récupérer les données d'une capteur température.
Je cherche donc a comprendre comment programmer ce type de communication.

J'avais commencer avec ce type de code pour tester mais rien ne fonctionne.

#include <SoftwareSerial.h>
#define DirectionControl 2
#define Pin13LED 13
int RX;
const byte rxPin = 0;
const byte txPin = 1;

// set up a serial object
SoftwareSerial mySerial (rxPin, txPin);

void setup() {
Serial.begin(9600);
Serial.println("Configuration serial:\n");
mySerial.begin(9600);
Serial.println("Configuration RS485" );
Serial.println("set up done!!");

pinMode(Pin13LED, OUTPUT);
pinMode(DirectionControl, OUTPUT);

digitalWrite(DirectionControl, LOW); //preparing for receiption
//pinMode(rxPin,INPUT);
//pinMode(txPin,OUTPUT);
mySerial.begin(9600);
delay(2000);
digitalWrite(DirectionControl, HIGH);
/*mySerial.write((byte)0x00);
mySerial.write((byte)0x03);
mySerial.write((byte)0x00);
mySerial.write((byte)0x00);
mySerial.write((byte)0x00);
mySerial.write((byte)0x01);
mySerial.write((byte)0x85);
mySerial.write((byte)0xDB);
Serial.println(" "); */

digitalWrite(Pin13LED, LOW);
delay(10);
digitalWrite(DirectionControl, LOW);

}

void loop() {
//Serial.println("Bonjour");
if (mySerial.available())
{
RX = mySerial.read(); // Read the byte
//Serial.println(RX);}

digitalWrite(Pin13LED, HIGH); // Show activity
delay(2000);
digitalWrite(Pin13LED, LOW);
delay(2000);
Serial.println(RX, HEX);
// Serial.write(RX);
}
else {Serial.println("ERROR!"); // print this if serial is not available
delay(2000);}
}