Community
cancel
Showing results for 
Search instead for 
Did you mean: 
JJord1
Novice
1,310 Views

Galileo Gen 2 Arduino Ethernet problem

Jump to solution

Hi,

I am trying to run the basic Web client example in the Arduino IDE but I am having some problems. I have adapted it to claim a fixed IP as I don't have a DHCP server on the network.

# include

# include

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);

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");

}

}

// the loop function runs over and over again forever

void loop() {

if (client.available()) {

char c = client.read();

Serial.print(c);

}

if (!client.connected()) {

Serial.println();

Serial.println("disconnecting.");

client.stop();

for(;;)

;

}

}

This is what I see as a result:

ip - 192.168. 15.177 

255.255.255.255

 

connecting...

 

connection failed

 

 

disconnecting.

I have tried some workarounds found in forums (interface up, disable de SD card) but nothing worked.

What I am doing wrong?

Thanks

0 Kudos
1 Solution
FTinetti
Honored Contributor I
87 Views

Hi Blasi,

Take a look to comments and exaamples at

HTH,

Fernando.

View solution in original post

2 Replies
FTinetti
Honored Contributor I
88 Views

Hi Blasi,

Take a look to comments and exaamples at

HTH,

Fernando.

View solution in original post

JJord1
Novice
87 Views

The solution was to change Interface name. The actual commands to be run are these ones:

system("ifconfig enp0s20f6 down ");

system("ip link set enp0s20f6 name eth0");

system("ifconfig eth0 up");

Thanks.

Reply