Hi everyone!
I bought an Arduino Ethernet Shield without POE module.
I proved with this sketch to connect the ethernet shield but when I prove to ping the arduino ip, I can't ping it.
This is the code:
#include <String.h>
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0E, 0xAC, 0x68 };
byte ip[] = { 192, 168, 0, 10 }; // indirizzo IP della shield
//creo una variabile char per memorizzare i byte letti dal client
char Data_RX;
//creao un oggetto server che rimane in ascolto sulla porta
//specificata
EthernetServer ArduinoServer(80);
void setup()
{
//inizializza lo shield con il mac e l'ip
Ethernet.begin(mac, ip);
//inizializza l'oggetto server
ArduinoServer.begin();
}
void loop()
{
//fai qualcosa!
delay(10);
}
What's the problem?
thank you and sorry for my bad English
Good. The SPI bus connection to the w5100 is working. Try this sketch. See if the arduino gets an ip from a dhcp server. Does it display "dhcp failed" or "IP is 192.168.0.x"? The 'x' will be a number.
but if is use this sketch with ip=192.168.0.8 can't ping.
#include <String.h>
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0E, 0xAC, 0x68 };
byte ip[] = { 192, 168, 0, 8 }; // indirizzo IP della shield
//creo una variabile char per memorizzare i byte letti dal client
char Data_RX;
//creao un oggetto server che rimane in ascolto sulla porta
//specificata
EthernetServer ArduinoServer(80);
void setup()
{
//inizializza lo shield con il mac e l'ip
Ethernet.begin(mac, ip);
//inizializza l'oggetto server
ArduinoServer.begin();
}
void loop()
{
//fai qualcosa!
delay(10);
}
That is not a surprise to me. That ip is within the dhcp range for that router. Many routers will not recognize a static ip that is within the dhcp ip range. If you want to set a static ip, you must use one outside the dhcp range. Log in to your router and check what ip range the dhcp server issues, then pick an ip outside that range. Usually the routers have a few ips on each end of the range you can use for static ips.