system
April 14, 2013, 7:18pm
1
I get a Arduino Ethernet Shield on my Arduino Uno board.
Make a sketch that initialize my Ethernet with the folowing code :
#include <Ethernet.h>
#include <SPI.h>
byte ip[] = { 192, 168, 0, 198 }; //Manual setup only
byte gateway[] = { 173, 242, 209, 65 }; //Manual setup only
byte subnet[] = { 255, 255, 255, 224 }; //Manual setup only
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
EthernetServer server = EthernetServer(80); //port 80
Ethernet.begin(mac, ip, gateway, subnet); //for manual setup
server.begin(); /* Ethernet */
and send data with
client.print();
My sketch work weel if I stay within my router. But if I go outside my router (on internet not Ethernet) unable to find the URL.
Propably a question of addressing my router or my Arduino shield.
If someone can help....it will be appreciate.
Thank
Your challenge is due to this:
byte ip[] = { 192, 168, 0, 198 }; //Manual setup only
byte gateway[] = { 173, 242, 209, 65 }; //Manual setup only
byte subnet[] = { 255, 255, 255, 224 }; //Manual setup only
On this localnet, your gateway is unreachable. Since it works localnet, I presume the ip is correct, but the subnet mask and/or gateway is incorrect.
edit:
// this
Ethernet.begin(mac, ip, gateway, subnet);
// should be this
Ethernet.begin(mac, ip, gateway, gateway, subnet);
system
April 14, 2013, 8:40pm
3
Thank for the help...
I take the subnet mask and the default gateway number on my DLINK device info page on the WAN section.
This is how my code look:
byte ip[] = { 192, 168, 0, 198 }; //Manual setup only
byte gateway[] = { 173, 242, 209, 65 }; //Manual setup only
byte subnet[] = { 255, 255, 255, 224 }; //Manual setup only
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
EthernetServer server = EthernetServer(80); //port 80
void setup()
{
Ethernet.begin(mac, ip, gateway, gateway, subnet); //for manual setup
server.begin();
.
.
..
}
Which URL address I have to call on my browser to access my arduino outside my localnet ?
Thank again...very appreciate
Alain
system
April 14, 2013, 9:44pm
4
Trying different thing......pffffff
Now getting the information by IPCONFIG command in <accessory/dos command>
This is how my code look now:
byte ip[] = { 192, 168, 0, 198 };
byte gateway[] = { 192, 168, 0, 1 };
byte subnet[] = { 255, 255, 255, 0 };
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
EthernetServer server = EthernetServer(80); //port 80
void setup()
{
Ethernet.begin(mac, ip, gateway, gateway, subnet); //for manual setup
server.begin();
.
.
..
}
But still don't know which URL address I have to call on my browser to access my arduino outside my localnet ?
Thank again...very appreciate
Alain
system
April 14, 2013, 11:35pm
6
You're right Zoomcat !!! and you too SurferTim the right code was "Ethernet.begin(mac, ip, gateway, gateway, subnet);"
Found the information by reading your old message on this forum before you get back to me Zoomcat...héhéhé
But THANK A LOT for the present message and the old one ....hahahaaha.
I do a port fowarding on my router and it's WORK now. Testing on my cellular.
I think it will work until I shut off my router.... after that my Internet provider will probably assign me a new IP address and i will have to make a new port forwarding or get a dynamic IP service.
Am I obligate to my Internet provider to have a dynamic IP address or it exist differents ways ?
Again thank all for the help....
Alain
u need a Dynamic DNS service
Dynamic DNS (DDNS) is a method of automatically updating a name server in the Domain Name System (DNS), often in real time, with the active DDNS configuration of its configured hostnames, addresses or other information.
The term is used to describe two different concepts. The first is "dynamic DNS updating" which refers to systems that are used to update traditional DNS records without manual editing. These mechanisms use TSIG to provide security. The second kind of dynamic DNS permits lightwe...
http://dnslookup.me/dynamic-dns/