Sharing Variables Between Two Arduinos Over LAN

Hi,

Always hate asking a question as the first foray into a new forum. But, im hoping for some pointers in the rite direction. That is, don't need hand holding, just a pointer that im following the correct route.

The code I have is working as intended, I have all inputs and outputs in the same code. However I need one Arduino for the input and the other for the output, over a LAN.

Arduino A:

Potentiometers, lots of them, outputting a number on a assigned variable as they should. Joysticks basically.

Arduino B:

Needs to see the variables given by the potentiometers.

Have been happy with learning everything upto the ethernet stage, as there seems a lot of different options for what I want to do. I noted the chat server example, and wondered if it could be ported to send variable values, and print them to the remote Arduino, instead of chat messages.

Any input is appreciated.

on one Arduino you start a Server (ErhernetServer, WiFiServer). on second Arduino you use a Client (EthernetClient, WiFiClient) to connect to the server. Server creates Client from Server and the two Clients are connected. What you write or print to one of them, the second can read or parse.

Thanks for the reply. Started looking through the standard ethernet examples. Although I have the ENC28J60 ethernet modules, and the examples for that are a bit different.

I get that I need the far Arduino to be the client, requesting the data from the near Arduino, the server. If we ignore for a second the mecahnics around the server/client whats the actual programming for using the requested data on the far side.

So as an example we have int aVariable being generated on the server by a potentiometer. In the current code this is just being fed to pin X. But once its split so that pin is now on the far Arduino im confused as how to utilise it there.

As a side note, just in case there is a different way of doing it, the LAN it will be traveling over is exclsuiviley for these two arduinos.

Arduino Ground End - switch - fibre link - 200m fibre - fibre link - switch - Air End

Also ideally, as a secondary goal i want to get two way communications going, to be able to send some sensor values to the ground end.

the UIPEthernet library has EthernetServer and EthernetClient.

if you do not connect over a hub or router, use crossover cable and set static IP in Ethernet begin