can't connect local host

Hola,
Necesito acceder a un servidor local que tiene la dirección (10.0.0.24):
http://semaforo.int.tecnilogica.com/
Esta dirección me va proporcionando un código variable (0,1 ó 2), pero no logro
conectar. Este es mi código

#include <SPI.h>
#include <Ethernet.h>

#define RELAY1 7// Controla Led Verde
#define RELAY2 6// Controla Led Rojo

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char server[] = "10.0.0.24";

EthernetClient client;

void setup() {
pinMode (RELAY1, OUTPUT);
pinMode (RELAY2, OUTPUT);

Serial.begin(9600);

if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
//while(true);
}

Serial.print("IP del Arduino: ");
Serial.println(Ethernet.localIP());
delay(1000);
}

char inString[50];
int posicion = 0;

void loop(){

Serial.println("connecting to server...");

if (client.connect(server, 80)){
Serial.println("making HTTP request...");
client.println("GET htpp//semaforo.int.tecnilogica.com HTTP/1.1");
client.println("Host: 10.0.0.24");
client.println("Connection: close");
client.println();
}
else
// If you didn't get a connection to the server:
Serial.println("Connection Failed");

if(client.available()) {
Serial.println("Conectado");
char c = client.read();
while(Serial.available()){//Mientras haya datos por leer
inString[posicion++]=c;

if (c == 0 || c == 1|| c == 2){// Si leo un número
int x = (int) c; // Convierto el char en int
client.stop();
Serial.println("disconnecting.");
delay(1000);

if (x == 0){//TODO APAGADO
digitalWrite (RELAY1, LOW);
digitalWrite (RELAY2, LOW);
}
if (x == 1){//VERDE ENCENDIDO
digitalWrite (RELAY1, HIGH);
digitalWrite (RELAY2, LOW);
}
if (x == 2){//ROJO ENCENDIDO
digitalWrite (RELAY1, LOW);
digitalWrite (RELAY2, HIGH);
}
}// 2º IF
} // If
else {//Si no es un número
posicion=0; // Voy machacando la posicion 0
}
}//While
}//Client.available

else {
Serial.println();
Serial.println("not connected");
client.stop();
delay(1000);
}

}//Loop

Los datos que recibo son:

1

Donde el número es la variable que tengo que detectar.

El código me da error de conexión y no se por qué

Gracias por vuestra ayuda

Hi, it seems to me you use an old wrong code.
Look at here: Ethernet - Arduino Reference

Correct yours:

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char server[] = "10.0.0.24";

to this:

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 }; //your arduino IP
byte server[] = { 10, 0, 0, 24}; //server you want to connect to

NOTE:

The Ethernet.localIP() can be used only if you get the IP address over the DHCP:

The Ethernet.localIP() can be used only if you get the IP address over the DHCP:
Ethernet - Arduino Reference

That is not correct. You can use that for a static IP also. I use that to check the SPI bus.

OK
Now I can connect to localhost, but I can't read the number I want.

""Bad request to server"

Where can I learn how to put the parameters of GET (for reading a html or php file), I only see the examples to google and I don't understand well.

Where can I learn how to put the parameters of GET (for reading a html or php file), I only see the examples to google and I don't understand well.

The only argument to GET is the name of the script to execute on the server, followed by ?name1=value&name2=value2&...&nameN=valueN to define the data that the script needs.

The only way to know what name=value pairs to send is to know what the script expects.

;D :smiley:
Muchas gracias