Controllare Arduino Mega con Ethernet Shield tramite comando o link diretto

Salve a tutti, sono nuovo di questo forum e di Arduino in generale.
quello che vorrei ottenere è di controllare circa 45 relè con arduino Mega con ethernet shield tramite lan.
ho già provato a pilotare questi relè tramite usb e riga di comando e non ho avuto problemi.
per il mio progetto ho bisogno di integrare software di terze parti quindi vorrei che questi relè si attivassero senza dover utilizzare un browser ma inviando direttamente un comando dal software che utilizzo (autoplay media studio).
Inviando un comando tramite usb non ho avuto problemi, ma tramite lan non sò se posso farlo.
esiste la possibilità di attivare un relè tramite un comando batch usando esclusivamente la lan, in caso positivo avete qualche sketch che possa essermi d'aiuto?
Grazie in anticipo

You can use the Microsoft PowerShell to open a serial port and send commands.
Or did you have that already ? Does it have to be using ethernet ?
Perhaps using wget for windows, and retrieve something like http: //192.168.0.100?AB01CC804010
The number after the '?' could be the hexadecimal value for the relays.
A better option is perhaps using the PowerShell to create a client and use Downloadfile: Native alternative to wget in Windows PowerShell? - Super User
You don't really need to download a file, only to activate that url, so perhaps there is an other command in the PowerShell. I don't know, I haven't used the PowerShell often.

:slight_smile: Thanks for the answer, i think wget wil do my job, i will try and i'll let you Know
THANKS !!!

Ok, i confirm that with wget i can get wat i want,.
I'm a novice but i found a sketch ( at http://bildr.org/2011/06/arduino-ethernet-pin-control/ ) that let me acitvate a pin by a url.
But i don't know how to modify this sketch to let me turn off a pin, can you give me a hand?

and can i use all the pins of arduino mega or only 13 pins of the ethernet shield?

//ARDUINO 1.0+ ONLY
//ARDUINO 1.0+ ONLY


#include <Ethernet.h>
#include <SPI.h>
boolean reading = false;

////////////////////////////////////////////////////////////////////////
//CONFIGURE
////////////////////////////////////////////////////////////////////////
  //byte ip[] = { 192, 168, 0, 199 };   //Manual setup only
  //byte gateway[] = { 192, 168, 0, 1 }; //Manual setup only
  //byte subnet[] = { 255, 255, 255, 0 }; //Manual setup only

  // if need to change the MAC address (Very Rare)
  byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

  EthernetServer server = EthernetServer(80); //port 80
////////////////////////////////////////////////////////////////////////

void setup(){
  Serial.begin(9600);

  //Pins 10,11,12 & 13 are used by the ethernet shield

  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);

  Ethernet.begin(mac);
  //Ethernet.begin(mac, ip, gateway, subnet); //for manual setup

  server.begin();
  Serial.println(Ethernet.localIP());

}

void loop(){

  // listen for incoming clients, and process qequest.
  checkForClient();

}

void checkForClient(){

  EthernetClient client = server.available();

  if (client) {

    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    boolean sentHeader = false;

    while (client.connected()) {
      if (client.available()) {

        if(!sentHeader){
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          sentHeader = true;
        }

        char c = client.read();

        if(reading && c == ' ') reading = false;
        if(c == '?') reading = true; //found the ?, begin reading the info

        if(reading){
          Serial.print(c);

           switch (c) {
            case '2':
              //add code here to trigger on 2
              triggerPin(2, client);
              break;
            case '3':
            //add code here to trigger on 3
              triggerPin(3, client);
              break;
            case '4':
            //add code here to trigger on 4
              triggerPin(4, client);
              break;
            case '5':
            //add code here to trigger on 5
              triggerPin(5, client);
              break;
            case '6':
            //add code here to trigger on 6
              triggerPin(6, client);
              break;
            case '7':
            //add code here to trigger on 7
              triggerPin(7, client);
              break;
            case '8':
            //add code here to trigger on 8
              triggerPin(8, client);
              break;
            case '9':
            //add code here to trigger on 9
              triggerPin(9, client);
              break;
          }

        }

        if (c == '\n' && currentLineIsBlank)  break;

        if (c == '\n') {
          currentLineIsBlank = true;
        }else if (c != '\r') {
          currentLineIsBlank = false;
        }

      }
    }

    delay(1); // give the web browser time to receive the data
    client.stop(); // close the connection:

  } 

}

void triggerPin(int pin, EthernetClient client){
//blink a pin - Client needed just for HTML output purposes.  
  client.print("Turning on pin ");
  client.println(pin);
  client.print("
");

  digitalWrite(pin, HIGH);

}

@moto il codice devi racchiuderlo nei tag code (usi il pulsante con simbolo # quando sei in modalità inserimento o modifica)
oppure guarda regolamento, sezione 7 spiega come fare.

Ma questa non è una sezione ita?

grazie ho midificato il post, effettivamente è in italiano ma all'utente che mi ha gentilmente risposto in inglese ho preferito rispondere in inglese