I found the following code extracts for the Arduino (I have a Diavolino) to work with the RS485 shield from here:

Code for the transmitter:

void setup()
{
        Serial.begin(115200);
}
 
void loop()
{
    Serial.println ("hello RX_Test");
    delay(1000);
}

Code for the receiver:

String mydata = "";
 
void setup()
{
    Serial.begin(115200);
}
 
void loop()
{
    while (Serial.available() > 0)  
    {
        mydata += char(Serial.read());
        delay(2);
    }
    if (mydata.length() > 0)
    {
        Serial.print(mydata);
        mydata = "";
    }
}

And a guide for the R-Pi shield (from here).

Putting the two together (I don’t have two Arduinos and shields) so using the R-Pi and the Arduino, with the R-Pi set to be master, and the R-Pi as a slave,

I have carried out the two changes to the R-Pi config from here, and installed minicom (Bob is helping).

sudo apt-get install minicom
minicom -s
F - Turn off flow control
A - /dev/ttyAMA0
E - 115200 8N1

Wire the R-Pi and the Arduino together

Raspbery Pi and Arduino connected via RS485

Raspbery Pi and Arduino connected via RS485 (note the RS485 connections).

Using both Arduino Sketches above, you can get two way coms from the Arduino (via the Serial Monitor) to the Raspberry Pi:

Set up for long distance communcations…

Set up for long distance communcations… of about 300mm

to exit from Minicom Ctrl+A, then Q