Eternet shield help

Hello guys,

I have been trying to solve this problem but i hit a wall, so i hope u can help me.

I have been trying to send an e mail using this tutorial (the secound code, one with SMPT2GO): Arduino Playground - Email.

There are 4 things to change so you get the resault: IPAddress, IPAddress gateway, IPAddress subnet, and Arduinos IP

Now because i am new at networking and stuff, i dont know wich one i missed, i used gateway and subnet from my computer. I dont know wich one i should use for IPAddress ip, and Arduinos IP.

Here are some pictures



Thanks

Bump, i really need help with this

I would imagine you would need the IP address of the mail server.

First - Are you connected to your ethernet. Can you ping your Arduino ethernet shield on address 192.168.1.5 ?
If you are connected then please supply us with the output from your Serial monitor.
Where does your sketch stop?
It's much easier to help if we get as much info as possible.

/ffur

Simple client code you can try unmodified to see if you can get a response from the external server.

//zoomkat 11-04-13
//simple client test
//for use with IDE 1.0.1
//with DNS, DHCP, and Host
//open serial monitor and send an e to test client GET
//for use with W5100 based ethernet shields
//remove SD card if inserted
//data from myIP server captured in readString 

#include <SPI.h>
#include <Ethernet.h>
String readString;

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

char serverName[] = "checkip.dyndns.com"; // myIP server test web page server
EthernetClient client;

//////////////////////

void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }

  Serial.begin(9600); 
  Serial.println("client readString test 11/04/13"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
  Serial.println();
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
  {
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
    {
      sendGET(); // call sendGET function below when byte is an e
    }
  }  
} 

//////////////////////////

void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET / HTTP/1.1"); //download text
    client.println("Host: checkip.dyndns.com");
    client.println("Connection: close");  //close 1.1 persistent connection  
    client.println(); //end of get request
  } 
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    readString += c; //places captured byte in readString
  }

  //Serial.println();
  client.stop(); //stop client
  Serial.println("client disconnected.");
  Serial.println("Data from server captured in readString:");
  Serial.println();
  Serial.print(readString); //prints readString to serial monitor 
  Serial.println();  
  Serial.println();
  Serial.println("End of readString");
  Serial.println("==================");
  Serial.println();
  readString=""; //clear readString variable

}

I need to create a web client with Arduino and Ethernet Shield and several possible combinations never got a valid IP for the Arduino .
Ethernet.begin ( mac ) the system stops on this line. To begin ( mac, ip) the system assigns the IP 0.25.25.25 . Already blocked the SD card system with the pin 4 to LOW and HIGH , already used the begin ( mac, ip , dns , gateway mask ) and the result was the same attachment the last code. The idea is to run a php page that inserts a record in mysql table.

#include <Ethernet.h>
#include <SPI.h>

EthernetClient client;

byte mac[] = { 144, 162, 218, 16, 66, 237 };
byte ip[] = { 192, 168, 1, 151 };
byte mydns[] = { 192, 168, 1, 1 };
byte gateway[] = { 192, 168, 1, 1 };
byte mask[] = { 255, 255, 255, 0 };
byte server[] = { 192, 168, 1, 150 };

void setup()
{
Ethernet.begin(mac,ip); //, mydns, gateway, mask);
delay(1000);
pinMode(4, OUTPUT);
//pinMode(10, OUTPUT);
//digitalWrite(10, LOW);
digitalWrite(4, HIGH);

Serial.begin(9600);
delay(1000);

Serial.println("connecting...");
Serial.print(Ethernet.localIP());

if (client.connect(server, 80)) {
Serial.println("connected");
client.println("/arduino/index.php");
client.println();
} else {
Serial.println("connection failed");
}
}

void loop()
{
}

VitorAlves:
never got a valid IP for the Arduino

Which Ethernet Shield do you have? The Ethernet library only supports the W5100 Ethernet controller based shields but there are some other shields with different chips that require a different library. If you aren't sure you could check the chip on the shield or post a link to where you bought your shield.

The board is Ethernet shield 2 (Shield ETH11 V2)

VitorAlves:
The board is Ethernet shield 2 (Shield ETH11 V2)

The Ethernet Shield 2 uses the W5500 Ethernet controller chip instead of the W5100 chip on the Ethernet Shield. The Ethernet library is not compatible with the W5500. If you're using the arduino.org IDE then you can just change the line in your sketch from:

#include <Ethernet.h>

to:

#include <Ethernet2.h>

If you're using the arduino.cc(this website) IDE, which I would highly recommend then you only need to install an Ethernet library that supports the W5500. There are a few choices:

Ethernet2 library - this is the same library included with the arduino.org IDE

EthernetMod W5x00 branch - This supports W5100, W5200, and W5500 without needing any modifications
GitHub - per1234/EthernetMod at W5x00 follow the installation instructions on that page, you don't need to make any changes to your current sketch.

Wiznet Ethernet Library - GitHub - Wiznet/WIZ_Ethernet_Library: WIZnet Ethernet Library this is already set up to support the W5500 but the installation is slightly complicated so let me know if you want to install that one and need help with installation.

Thank you, it's work :), I lose 2 days with this problem, try all possibility and reading all text about Shield Ethernet

Hi Helter_Skelter
I think VitorAlves did clobber your question up. He should have started another sequence.
Please try zoomkat's sketch - he knows what he's talking about.
Else try some of the simpler examples in the IDE - ex. WebServer.

/ffur

Hey zoomkat,

First of all thank you, and secound

I tried to use your program, but i get nothing on my serial monitor, i tried to use another sketch that uses serial monitor, and it is working ok, i also tried to use 2 different arduinos :confused: