Facciamo un pò di debug insieme.
COSE DA SAPERE
1. ad ogni apertira del serial mnonitor arduino si resetta (e questo poi ti spiegerà perchè funziona il tuo codice al reset)
2. Ad OGNI richiesta GET(o POST) la connessione viene chiusa (e anche questo fa parte della soluzione)
3. usa i tag [ code] e [ /code], sennè non si capisce una mazza

#include <Client.h>
#include <Ethernet.h>
#include <Server.h>
#include <SPI.h>
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,0,108 };// my client (arduino n°1)
byte server[] = { 192,168,0,107 }; // my server (arduino n°2)
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
Client client(server, 80);
// constants won't change. They're used here to
// set pin numbers:
const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 7; // the number of the LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
vabbè direi che fino a quì dovresti capirci tutto
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
Ethernet.begin(mac, ip);
// start the serial library:
Serial.begin(9600);
// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println("connecting...");
// if you get a connection, report back via serial:
if (client.connect())
Serial.println("connected");
else {
if (!client.connect())
// if you didn't get a connection to the server:
Serial.println("connection failed");
}
}
Quì inizializzi un pò di roba e fai partire la connessione.. tutto ok
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
client.println("POST /led=1");
client.println();
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
client.println("POST /led=0");
client.println();
}
}
Quì invii la richiesta all'arduino server, che accetta il tuo comando e poi chiude la connessione. Inutile dire che alla prossima richiesta, visto che non fai nessun controllo sullo stato della connessione (che ricordiamo ora è chiusa), i comandi successivi non vengono inviati.
Altro problema: tu vuoi inviare una richiesta get OGNI loop(), quindi migliaia al secondo (se non milioni), capirai bene che questa cosa saturerà la tua banda (niente di grave, il codice funzionerà ma il tuo router non sarà di certo felice)...
la cosa migliore sarebbe inviare una richiesta quando il pulsante cambia di stato (quindi ti salvi da qualche parte il valore dell'ultima richiesta, se è diversa dallo stato attuale del pulsante invii una nuova richiesta etc..)
good luck