WIZ811MJ only connects with DHCP

I have the WIZ811MJ that I’m testing with an Uno. I’m using the WebClient example program in the Ethernet.h library. It works fine if I connect using DHCP like this:

Ethernet.begin(mac);

But I don’t want to use DHCP because it uses up a lot of memory, I want to connect with the IP like this:

Ethernet.begin(mac,ip);

But it does’t set the IP and thus never connects.

I tried the exact same sketch on an Uno with Ethernet shield R3 and both ways worked fine. Here’s the code I’m using:

[code]#include <SPI.h>
#include <Ethernet.h>

byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char server = “www.google.com”; // name address for Google (using DNS)
IPAddress ip(192,168,216,46);
EthernetClient client;

void setup() {
Serial.begin(9600);

Ethernet.begin(mac, ip);

// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println(“connecting…”);

// if you get a connection, report back via serial:
if (client.connect(server, 80)) {
Serial.println(“connected”);
// Make a HTTP request:
client.println(“GET /search?q=arduino HTTP/1.1”);
client.println(“Host: www.google.com”);
client.println(“Connection: close”);
client.println();
}
else {
// kf you didn’t get a connection to the server:
Serial.println(“connection failed”);
}
}

void loop()
{
// if there are incoming bytes available
// from the server, read them and print them:
if (client.available()) {
char c = client.read();
Serial.print(c);
}

// if the server’s disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println(“disconnecting.”);
client.stop();

// do nothing forevermore:
while(true);

}
}

[/code]

Hi scott216 ,

If you don’t want to use DHCP, you should be used “public IP address” for connecting to external network.

Private IP address, can connect to local network, is used in your code.

Thasnks,

[quote=“suhwan”]Hi scott216 ,

If you don’t want to use DHCP, you should be used “public IP address” for connecting to external network.

Private IP address, can connect to local network, is used in your code.

Thasnks,[/quote]
You misunderstand. The IP I’m talking about is not what I’m trying to connect too, it’s the IP assigned to my Arduino+WIZ811MJ, which is part of my LAN.