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:
Serial.println ("hello RX_Test");
Code for the receiver:
String mydata = "";
while (Serial.available() > 0)
mydata += char(Serial.read());
if (mydata.length() > 0)
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
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 (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… of about 300mm
to exit from Minicom Ctrl+A, then Q