Control Over Ethernet

Hi all;
I'm very new to Arduino & I found myself in the middle of a big task. I need help with this one, or at least someone tell me if it's possible or not.
Can I have a network of Arduino's with their Ethernet shields, then perform control over the network? for example pressing a switch on one board puts on an LED on another board ...
If possible, I appreciate if you can suggest a link or something that can help me work on this, thx.

Yes, it is possible.

But we need more info. what ethernet shield is it, and how does it work? We need at least some basic code, showing how it can be used.

This is a filler post.

Ok now I can post.

@bld
The Ethernet shield used is the one shown here Arduino Ethernet Shield - DEV-09026 - SparkFun Electronics.

I'm not sure I understand which code you require. The standard Ethernet library is used.

Right now we are trying to connect two of the Arduino duemilanove boards each with is own Ethernet shield. The 2 boards are connected using a router. One is configured with a webserver & the other as a client. Communication works properly when sending from the client to server. However, it doesnt work the other way around.
Eventually our target is to send a control signal from each board to the other. The control signal will be triggered by a sensor or switch & we need 2 way communications.
We need help fixing this issue if it's at all fixable.

I assume you are trying to communicate over the ethernet but what are you trying to switch?

Just a curiosity question as to what pin, type of switch sensor and how it is triggered so we can better get a feel for the project.

FD5; can you upload the code you have so far? & more details about which pins we want to control?
We are the very first phase of trying this kind of communications over the boards. Eventually we want an RFID reader connected to one board & when this reader reads a tag, it'll send a trigger signal to the other boards to flash some lights & sounds.
For now, if we can just send the message correctly between the 2 boards & use this message to flash some LEDs on both sides, that'd b of great help to us.

It should be easy to do, but impossible to help with without seeing any code first. :slight_smile:

Here is the code for the client followed by the code for the server:

#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 0, 110 };
byte server[] = { 192, 168, 0, 111 };

Client client(server, 80);
//Client on COM11
//Server on COM10

void setup()
{
  Ethernet.begin(mac, ip);
  Serial.begin(9600);
  
  delay(1000);
  
  Serial.println("connecting...");
  
  if (client.connect()) {
    Serial.println("**CLIENT** connected");
    //client.println("**CLIENT** GET /search?q=arduino HTTP/1.0");
    //client.println();
  } else {
    Serial.println("**CLIENT** connection failed");
  }
}

void loop()
{
  //client.print("First connect");
 // if (client.available()) {
    Serial.println("Sending...");
    client.println("S");
    char c = client.read();
    Serial.print(c);
//    for(int i=0; i < 5; i++){
//      if(i==4){
        for(;;)
        ;
//      }
   // }
 // }
  
  if (!client.connected()) {
    Serial.println();
    Serial.println("**CLIENT** disconnecting.");
    client.stop();
    for(;;)
      ;
  }
}//CLIENT ON COM11

SERVER

/*
 * Web Server
 *
 * A simple web server that shows the value of the analog input pins.
 */

#include <Ethernet.h>
//COM10
byte mac[] = { 0xEE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 0, 111 };

Server server(80);

void setup()
{
  Ethernet.begin(mac, ip);
  server.begin();
  Serial.begin(9600);
  
  delay(1000);
  Serial.println("**SERVER** Server started");
}

void loop()
{

  Client client = server.available();

  if (client) {
    boolean current_line_is_blank = true;
          Serial.println("**SERVER** Client connected");
    while (client.connected()) {
      Serial.println("**SERVER** Client connected");
//      if (client.available()) {
//        char c = client.read();
//        Serial.println(c);
//        if (c == '\n' && current_line_is_blank) {
////          for (int i = 0; i < 6; i++) {
////            client.print("analog input ");
////            client.print(i);
////            client.print(" is ");
////            client.print(analogRead(i));
////            client.println("
");
////          }
//          break;
//        }
//        if (c == '\n') {
//          // we're starting a new line
//          current_line_is_blank = true;
//        } else if (c != '\r') {
//          // we've gotten a character on the current line
//          current_line_is_blank = false;
//        }
//      }
        char c = client.read();

        Serial.print(c);
        server.println("O");
          for(;;)
      ;
    }
    // give the web browser time to receive the data
    delay(1);
    client.stop();
  }
}//SERVER ON COM10