i have gotten a project off of instructables.com to use a website to change a light color. its a beginner project and i used the 1.0 project code. my problem is my router give the shield an ipaddress and it expires. the router is set to allow 1 day leases. however as soon as i hook up the shield and look at the addresses handed out the shield is expired.
my problem is my router give the shield an ipaddress and it expires. the router is set to allow 1 day leases. however as soon as i hook up the shield and look at the addresses handed out the shield is expired.
How do you know it expired? Where are you looking at the addresses? In the router? Or the Arduino? What are the addresses it shows?
i use a linksys wireless router with 4 ports for wired lines. if you go to the router GUI and status -> local network tab you can see the client statuses. all my computers say how long the lease is left but the arduino shows expired and i can not access it.
Have you tried the DhcpAddressPrinter sketch in the ethernet examples? Compile and upload, then open the serial monitor. If you get an ip, then check your router to see if that is expired.
What version of the IDE are you using? Here is the lease from my router after running DhcpAddressPrinter. I lease for 2 days. It shows 1d23h51m52s left. That looks about right.
I do not know what version of the IDE you are using, but it isn't v1.0. Here is the sketch code from the examples.
/*
DHCP-based IP printer
This sketch uses the DHCP extensions to the Ethernet library
to get an IP address via DHCP and print the address obtained.
using an Arduino Wiznet Ethernet shield.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
created 12 April 2011
by Tom Igoe
*/
#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;
void setup() {
// start the serial library:
Serial.begin(9600);
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
for(;;)
;
}
// print your local IP address:
Serial.print("My IP address: ");
for (byte thisByte = 0; thisByte < 4; thisByte++) {
// print the value of each byte of the IP address:
Serial.print(Ethernet.localIP()[thisByte], DEC);
Serial.print(".");
}
Serial.println();
}
void loop() {
}
It may take a minute or more to time out if there is no dhcp server on the localnet.
If it doesn't return with either an error or an ip after about 3 minutes, then you might need to update your IDE to v1.0.1. I don't have the link to it handy, but if you search for that, you should find it. That is the actual version I am on now.
has to be this guys code. i finally got it to display the webpage and the function of it doesnt work. off to learn how to host a website on the arduino i guess. thanks everyone.