Hi, I am really new in Arduino but I've been programming for netduino for sometime. Now I encountered a problem which my arduino does not appear on my DHCP client table in my router. Here is a snippet of my code:
if(Ethernet.begin(mac)) {
printer.wake();
printer.println("OK");
printer.sleep();
}
else {
printToPrinter("No DHCP response, using static IP address.");
Ethernet.begin(mac, ip);
}
This piece of code is my my setup() and printToPrinter is a function that prints to my thermal printer. When I run this code last time the Ethernet.begin(mac)
hangs, I resolved somehow.
Now I can see my printer prints out the IP address so it means the DHCP worked. When I kept writing code that envolves EthernetServer and EthernetClient, problem arrises.
The problem is that all my code work fine when I plugged my USB cable, and I can see my arduino in my DHCP client table, but nothing works when I let this thing run standalone. Did I do anything wrong? I will post the entire source code if it helps. Thank You!