I think my Ethernet Shield may be defective, and I'm wondering how best to diagnose the possible damage?
I know that my Mega board is working, I've had success with a few sketches reading from temperature sensors and controlling LEDs.
I've tried uploading a few sketches from tutorials I've found, but nothing seems to work, attempts usually end in the following error:
avrdude: stk500_recv(): programmer is not responding
I thought I was getting nothing when I uploaded the code and connected the ethernet cable, and was about ready to give up, but I tried the generic 'webserver' example again (File->Examples->Ethernet->Webserver) with just the board, detached from the shield, reattached the shield after uploading, and I found that (even though I didn't see it listed on the DHCP clients table through my router) I am getting some feedback from it when I give my browser its location:
analog input 0 is 570
analog input 1 is 533
analog input 2 is 445
analog input 3 is 426
analog input 4 is 427
analog input 5 is 392
Is it defective? It doesn't allow me to upload code while the shield is in place, but code works if I wait to attach the shield until after code is uploaded. Is there anything I can do to fix it without trying to solder anything?
Yoi are vague about the code you have been using, but the result of the last code you tried indicates the board is operating correctly. Below is a version of the code that you apparently tried that refreshes in the browser that you can try.
// zoomkat meta refresh server test code
// arduino IDE 1.0
// for W5100 ethernet shield
// the IP address will be dependent on your local network/router
// port 80 is default for HTTP, but can be changed as needed
// use IP address like http://192.168.1.102:84 in your brouser
// or http://zoomkat.no-ip.com:84 with dynamic IP service
// use the \ slash to escape the " in the html
// meta refresh set for 2 seconds
#include <SPI.h>
#include <Ethernet.h>
int x=0; //set refresh counter to 0
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1,102); // ip in lan
EthernetServer server(84); //server is using port 84
void setup()
{
// start the server
Ethernet.begin(mac, ip);
server.begin();
}
void loop()
{
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();
// see if HTTP request has ended with blank line
if (c == '\n') {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
//meta-refresh page every 2 seconds
x=x+1; //page upload counter
client.println("<HTML>");
client.print("<HEAD>");
client.print("<meta http-equiv=\"refresh\" content=\"2\">");
client.print("<TITLE />Zoomkat's meta-refresh test</title>");
client.print("</head>");
client.println("<BODY>");
client.print("Zoomkat's meta-refresh test IDE 1.0");
client.println("
");
client.print("page refresh number ");
client.println(x); //current refresh count
client.println("
");
client.println("
");
client.print("Zoomkat's arduino analog input values:");
client.println("
");
client.println("
");
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(analogRead(analogChannel));
client.println("
");
}
break;
client.println("</BODY>");
client.println("</HTML>");
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
}
}
Kent88:
But shouldn't I be able to upload sketches while the shield is on (connected) to the main board?
Should yes. If you bought an official shield and use an official Arduino.
The clones from places like eBay are generally the ones with the upload issue.
You can try bending pins 0 and 1 from the shield, to prevent them from going into the sockets of pins 0 and 1 on your Arduino. The shield doesn't need them.
I have a similar problem. When I use Ubuntu 12.04 to upload File->Examples->Ethernet->Webserver on Arduino 0022, the firefox never shows anything. But, when I am using Windows 7 or Ubuntu 11.04 to upload File->Examples->Ethernet->Webserver on Arduino 0022 IDE, the firefox shows the right things.