Arduino Ethernet shield not connecting












0















Im trying to connect my Arduino Mega 2560 to my ethernet shield generic HanRun HR911105A, however im having some troubles, im runing the ethernet example that comes with arduino IDE.



I give arduino an static ip 192.168.215.202, i tried many tutorials and none of them worked.





#include
#include


byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip = { 192, 168, 215, 203 };
byte server = { 64, 233, 187, 99 }; // Google

EthernetClient client;

void setup()
{
Ethernet.begin(mac, ip);
Serial.begin(9600);

delay(100);

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

if (client.connect(server, 80)) {
Serial.println("connected");
client.println("GET /search?q=arduino HTTP/1.0");
client.println();
} else {
Serial.println("connection failed");
}
}

void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}

if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}



It just prints:
connecting..
connection failed..
disconecting...



Im running Ubuntu 16.04, any suggestions? I ran out of ideas










share|improve this question













migrated from stackoverflow.com Nov 26 '18 at 17:21


This question came from our site for professional and enthusiast programmers.



















  • use the latest version of the Ethernet library and try the WebClient example of it

    – Juraj
    Nov 20 '18 at 19:12











  • Same mistake, im using version 2.0.0, it just gave me: Initialize Ethernet with DHCP: Failed to configure Ethernet using DHCP connecting to www.google.com... connection failed disconnecting. Received 0 bytes in 0.0000, rate = 0.00 kbytes/second

    – Jorge_Garza
    Nov 20 '18 at 20:52











  • what does the WebClient example print?

    – Juraj
    Nov 20 '18 at 20:53











  • Initialize Ethernet with DHCP: Failed to configure Ethernet using DHCP connecting to www.google.com... connection failed disconnecting. Received 0 bytes in 0.0000, rate = 0.00 kbytes/second

    – Jorge_Garza
    Nov 20 '18 at 20:53











  • My ethernet shield did not include the mac address sticker, so im using a manual set value byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; IPAddress ip(192, 168, 0, 177); IPAddress myDns(192, 168, 0, 1);

    – Jorge_Garza
    Nov 20 '18 at 20:55
















0















Im trying to connect my Arduino Mega 2560 to my ethernet shield generic HanRun HR911105A, however im having some troubles, im runing the ethernet example that comes with arduino IDE.



I give arduino an static ip 192.168.215.202, i tried many tutorials and none of them worked.





#include
#include


byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip = { 192, 168, 215, 203 };
byte server = { 64, 233, 187, 99 }; // Google

EthernetClient client;

void setup()
{
Ethernet.begin(mac, ip);
Serial.begin(9600);

delay(100);

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

if (client.connect(server, 80)) {
Serial.println("connected");
client.println("GET /search?q=arduino HTTP/1.0");
client.println();
} else {
Serial.println("connection failed");
}
}

void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}

if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}



It just prints:
connecting..
connection failed..
disconecting...



Im running Ubuntu 16.04, any suggestions? I ran out of ideas










share|improve this question













migrated from stackoverflow.com Nov 26 '18 at 17:21


This question came from our site for professional and enthusiast programmers.



















  • use the latest version of the Ethernet library and try the WebClient example of it

    – Juraj
    Nov 20 '18 at 19:12











  • Same mistake, im using version 2.0.0, it just gave me: Initialize Ethernet with DHCP: Failed to configure Ethernet using DHCP connecting to www.google.com... connection failed disconnecting. Received 0 bytes in 0.0000, rate = 0.00 kbytes/second

    – Jorge_Garza
    Nov 20 '18 at 20:52











  • what does the WebClient example print?

    – Juraj
    Nov 20 '18 at 20:53











  • Initialize Ethernet with DHCP: Failed to configure Ethernet using DHCP connecting to www.google.com... connection failed disconnecting. Received 0 bytes in 0.0000, rate = 0.00 kbytes/second

    – Jorge_Garza
    Nov 20 '18 at 20:53











  • My ethernet shield did not include the mac address sticker, so im using a manual set value byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; IPAddress ip(192, 168, 0, 177); IPAddress myDns(192, 168, 0, 1);

    – Jorge_Garza
    Nov 20 '18 at 20:55














0












0








0








Im trying to connect my Arduino Mega 2560 to my ethernet shield generic HanRun HR911105A, however im having some troubles, im runing the ethernet example that comes with arduino IDE.



I give arduino an static ip 192.168.215.202, i tried many tutorials and none of them worked.





#include
#include


byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip = { 192, 168, 215, 203 };
byte server = { 64, 233, 187, 99 }; // Google

EthernetClient client;

void setup()
{
Ethernet.begin(mac, ip);
Serial.begin(9600);

delay(100);

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

if (client.connect(server, 80)) {
Serial.println("connected");
client.println("GET /search?q=arduino HTTP/1.0");
client.println();
} else {
Serial.println("connection failed");
}
}

void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}

if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}



It just prints:
connecting..
connection failed..
disconecting...



Im running Ubuntu 16.04, any suggestions? I ran out of ideas










share|improve this question














Im trying to connect my Arduino Mega 2560 to my ethernet shield generic HanRun HR911105A, however im having some troubles, im runing the ethernet example that comes with arduino IDE.



I give arduino an static ip 192.168.215.202, i tried many tutorials and none of them worked.





#include
#include


byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip = { 192, 168, 215, 203 };
byte server = { 64, 233, 187, 99 }; // Google

EthernetClient client;

void setup()
{
Ethernet.begin(mac, ip);
Serial.begin(9600);

delay(100);

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

if (client.connect(server, 80)) {
Serial.println("connected");
client.println("GET /search?q=arduino HTTP/1.0");
client.println();
} else {
Serial.println("connection failed");
}
}

void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}

if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}



It just prints:
connecting..
connection failed..
disconecting...



Im running Ubuntu 16.04, any suggestions? I ran out of ideas







ethernet arduino-ide






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 '18 at 18:39







Jorge_Garza











migrated from stackoverflow.com Nov 26 '18 at 17:21


This question came from our site for professional and enthusiast programmers.









migrated from stackoverflow.com Nov 26 '18 at 17:21


This question came from our site for professional and enthusiast programmers.















  • use the latest version of the Ethernet library and try the WebClient example of it

    – Juraj
    Nov 20 '18 at 19:12











  • Same mistake, im using version 2.0.0, it just gave me: Initialize Ethernet with DHCP: Failed to configure Ethernet using DHCP connecting to www.google.com... connection failed disconnecting. Received 0 bytes in 0.0000, rate = 0.00 kbytes/second

    – Jorge_Garza
    Nov 20 '18 at 20:52











  • what does the WebClient example print?

    – Juraj
    Nov 20 '18 at 20:53











  • Initialize Ethernet with DHCP: Failed to configure Ethernet using DHCP connecting to www.google.com... connection failed disconnecting. Received 0 bytes in 0.0000, rate = 0.00 kbytes/second

    – Jorge_Garza
    Nov 20 '18 at 20:53











  • My ethernet shield did not include the mac address sticker, so im using a manual set value byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; IPAddress ip(192, 168, 0, 177); IPAddress myDns(192, 168, 0, 1);

    – Jorge_Garza
    Nov 20 '18 at 20:55



















  • use the latest version of the Ethernet library and try the WebClient example of it

    – Juraj
    Nov 20 '18 at 19:12











  • Same mistake, im using version 2.0.0, it just gave me: Initialize Ethernet with DHCP: Failed to configure Ethernet using DHCP connecting to www.google.com... connection failed disconnecting. Received 0 bytes in 0.0000, rate = 0.00 kbytes/second

    – Jorge_Garza
    Nov 20 '18 at 20:52











  • what does the WebClient example print?

    – Juraj
    Nov 20 '18 at 20:53











  • Initialize Ethernet with DHCP: Failed to configure Ethernet using DHCP connecting to www.google.com... connection failed disconnecting. Received 0 bytes in 0.0000, rate = 0.00 kbytes/second

    – Jorge_Garza
    Nov 20 '18 at 20:53











  • My ethernet shield did not include the mac address sticker, so im using a manual set value byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; IPAddress ip(192, 168, 0, 177); IPAddress myDns(192, 168, 0, 1);

    – Jorge_Garza
    Nov 20 '18 at 20:55

















use the latest version of the Ethernet library and try the WebClient example of it

– Juraj
Nov 20 '18 at 19:12





use the latest version of the Ethernet library and try the WebClient example of it

– Juraj
Nov 20 '18 at 19:12













Same mistake, im using version 2.0.0, it just gave me: Initialize Ethernet with DHCP: Failed to configure Ethernet using DHCP connecting to www.google.com... connection failed disconnecting. Received 0 bytes in 0.0000, rate = 0.00 kbytes/second

– Jorge_Garza
Nov 20 '18 at 20:52





Same mistake, im using version 2.0.0, it just gave me: Initialize Ethernet with DHCP: Failed to configure Ethernet using DHCP connecting to www.google.com... connection failed disconnecting. Received 0 bytes in 0.0000, rate = 0.00 kbytes/second

– Jorge_Garza
Nov 20 '18 at 20:52













what does the WebClient example print?

– Juraj
Nov 20 '18 at 20:53





what does the WebClient example print?

– Juraj
Nov 20 '18 at 20:53













Initialize Ethernet with DHCP: Failed to configure Ethernet using DHCP connecting to www.google.com... connection failed disconnecting. Received 0 bytes in 0.0000, rate = 0.00 kbytes/second

– Jorge_Garza
Nov 20 '18 at 20:53





Initialize Ethernet with DHCP: Failed to configure Ethernet using DHCP connecting to www.google.com... connection failed disconnecting. Received 0 bytes in 0.0000, rate = 0.00 kbytes/second

– Jorge_Garza
Nov 20 '18 at 20:53













My ethernet shield did not include the mac address sticker, so im using a manual set value byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; IPAddress ip(192, 168, 0, 177); IPAddress myDns(192, 168, 0, 1);

– Jorge_Garza
Nov 20 '18 at 20:55





My ethernet shield did not include the mac address sticker, so im using a manual set value byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; IPAddress ip(192, 168, 0, 177); IPAddress myDns(192, 168, 0, 1);

– Jorge_Garza
Nov 20 '18 at 20:55










0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
return StackExchange.using("schematics", function () {
StackExchange.schematics.init();
});
}, "cicuitlab");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "540"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2farduino.stackexchange.com%2fquestions%2f58214%2farduino-ethernet-shield-not-connecting%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown
























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Arduino Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2farduino.stackexchange.com%2fquestions%2f58214%2farduino-ethernet-shield-not-connecting%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

Npm cannot find a required file even through it is in the searched directory