I have an Intel Galileo Gen 2 Board and I am testing some code with the Arduino IDE. I am having problems when cofiguring the Ethernet network. I have the following code, basically evolved from the examples:
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server(192, 168, 15, 64);
IPAddress ip(192, 168, 15, 177);
IPAddress dnServer(8, 8, 8, 8);
IPAddress gateway(192, 168, 15, 1);
IPAddress subnet(255, 255, 255, 0);
EthernetClient client;
void setup() {
Serial.begin(9600);
Serial.print("ip - ");
Serial.println(ip);
Ethernet.begin(mac, ip, dnServer, gateway, subnet);
delay(1000);
system("ifup eth0");
delay(1000);
Serial.println(Ethernet.localIP());
Serial.println("connecting...");
if (client.connect("www.google.com", 80)) {
Serial.println("connected");
client.println("GET /search?q=arduino HTTP/1.1");
client.println("Host: www.google.com");
client.println("Connection: close");
client.println();
}
else {
// if you didn't get a connection to the server:
Serial.println("connection failed");
}
This is what I see as a result:
ip - 192.168. 15.177
255.255.255.255
connecting...
connection failed
disconnecting.
What I see is that no IP address is aparently assigned as the localIP indicates 255.255.255.255.
I have tried some workarounds found in forums (interface up, disable de SD card) but nothing worked. I tried even runing it without SD card but result was the same.
What I am doing wrong?
Thanks