plss help about ethernet shield

Arrch:
This would apply to a Potato if you could manage to get the TCP/IP stack on it. The device that is connected to the network is irrelevant in this situation; It is also about your router.

sir what do you mean with Potato?.. and which device did you mean that is irrelevant??....
below is the code i have tried for my old version of the shield. is there anyway i could make this to be controlled outside my network?

// A simple web server that turn an LED on or off"

#include "etherShield.h"
#include "ETHER_28J60.h"

int outputPin = 6;

static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24};   // this just needs to be unique for your network, 
                                                           
static uint8_t ip[4] = {192, 168, 1, 15}; // IP address for the webserver

static uint16_t port = 80; // Use port 80 - the standard for HTTP

ETHER_28J60 e;

void setup()
{ 
  e.setup(mac, ip, port);
  pinMode(outputPin, OUTPUT);
}

void loop()
{
  char* params;
  if (params = e.serviceRequest())
  {
    e.print("<h1><a href='/?led=off'>Arduino Web Remote</a></h1>");
    if (strcmp(params, "?led=on") == 0)
    {
      digitalWrite(outputPin, HIGH);
      e.print("<a href='?led=off'><button style='border: 1px solid #ff0000; border-left: 10px solid #ff0000' type='button'>LED IS ON</button></a>");
    }
    else if (strcmp(params, "?led=off") == 0)
    {
      digitalWrite(outputPin, LOW);
      e.print("<a href='?led=on'><button style='border: 1px solid #000; border-left: 10px solid #000' type='button'>LED IS OFF</button></a>");
    }
    e.respond();
  }
}

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

The type of ethernet shield you are using to connect to your router is irrelevant when it comes to understanding how your router is connected to the internet. You could be using a potato (well, probably not really) as a shield, and the stuff you need to do to enable external (internet) access to the Arduino with (potato) shield would be exactly the same.

PaulS:
The type of ethernet shield you are using to connect to your router is irrelevant when it comes to understanding how your router is connected to the internet. You could be using a potato (well, probably not really) as a shield, and the stuff you need to do to enable external (internet) access to the Arduino with (potato) shield would be exactly the same.

thank you for the reply sir.. so do you mean its ok i use this type of ethernet shield(EJ2680) as long as i am correct with my router settings to have external access on my arduino?(through internet)

pisayjames:
sir what do you mean with Potato?

Cut the "sir" crap.

This is what I mean by a potato:

and which device did you mean that is irrelevant??....

What ever is acting as a server, like a computer, Arduino Ethernet or the aforementioned potato.

thank you for the reply sir.. so do you mean its ok i use this type of ethernet shield(EJ2680) as long as i am correct with my router settings to have external access on my arduino?(through internet)

Yes.

another question... if i control the arduino with a web browser, could it also receive data from the arduino to update it? like for example i turned on a led using the webrowser, thus it display ledon.. now i turned it off using a pushbutton manually, is there a way the browser will automatically say ledoff?

if i control the arduino with a web browser, could it also receive data from the arduino to update it?

That sentence really needs a bunch of nouns, rather than all those pronouns. I have no idea what each of those its refers to.

like for example i turned on a led using the webrowser, thus it display ledon.. now i turned it off using a pushbutton manually, is there a way the browser will automatically say ledoff?

Yes, and no. There is NO way for a server to push information to a client. The client/server relationship is stateless. Once the server sends data to the client, it forgets that the client ever existed.

The server can embed meta tags in the page that it serves that tell the client that it needs to refetch the page every n seconds. It is up to the client software to see those tags, and to act on them.

The server, though, has no idea that a client request is a result of the user loading the page initially or the client refreshing the page.

aww.. too bad.. uhm so is there a way to solve my problem? what i really want is to have somehow like a "webserver" who can send and receive data to my arduino.. any suggestions?

uhm so is there a way to solve my problem?

There does not appear to be a way of correcting your misunderstanding of how client/server architecture works.

what i really want is to have somehow like a "webserver" who can send and receive data to my arduino.

A web server serves data. There is no way to make a server push data to a client. You wouldn't want google pushing data to you, would you?

A web client pulls data. It can include, in the GET request, information that the server uses to tailor the returned data. That could mean that the server does something like turning a pin on or off, too.

The server can tell the client, using meta tags, that it needs to check back later. That "check back later" part is a completely separate transaction, though.

what i mean is that. is there a way where i can make a simple UI with simple buttons to be displayed using a web browser where it can send and receive data from my arduino...?? please help me..

what i mean is that. is there a way where i can make a simple UI with simple buttons to be displayed using a web browser where it can send and receive data from my arduino.

Yes, the Arduino with Ethernet shield can serve up a web page containing a form with submit buttons.

Designing, testing, and implementing a web page is not an Arduino-specific task. If there are Arduino-specific parts you are having problems with, this is the place to discuss them.

What you are struggling with now is not Arduino-specific, so this is not the place for it.

ohhh more too bad for me cause i am not good at html..
uhmm last question.. is there a way that when i open the webserver i made will maintain the last state of my buttons when i reopen it?

Have your Arduino remember the state of the buttons and write the HTML page out next time in such a way that it shows the buttons in their previous state.

PeterH:
Have your Arduino remember the state of the buttons and write the HTML page out next time in such a way that it shows the buttons in their previous state.

uhmm does this apply to the webserver example of ethernet shield? .. can you show me simple codes to remember such states?

uhmm does this apply to the webserver example of ethernet shield? .. can you show me simple codes to remember such states?

const int switchCount = 5; // Use your value here
int switchStates[switchCount];

Then, in the rest of the code, update switchStates[ n ], and use switchStates[ n ] in the calls to digitalWrite().

thank you for the knowledge.. another problem for me, if i use a manual button like a push button to change the states of my arduino pins, and i include this for the update of the states, is there a way that my browser to get such updates? uhmm what i am thinking is that, is there like kind of "automatic refresh" feature so like for every 5 secs it would display the present states of my arduino?(if any manual buttons are used)

pisayjames:
thank you for the knowledge.. another problem for me, if i use a manual button like a push button to change the states of my arduino pins, and i include this for the update of the states, is there a way that my browser to get such updates? uhmm what i am thinking is that, is there like kind of "automatic refresh" feature so like for every 5 secs it would display the present states of my arduino?(if any manual buttons are used)

You asked that earlier in the thread and Paul gave you the answer:

Yes, and no. There is NO way for a server to push information to a client. The client/server relationship is stateless. Once the server sends data to the client, it forgets that the client ever existed.

The server can embed meta tags in the page that it serves that tell the client that it needs to refetch the page every n seconds. It is up to the client software to see those tags, and to act on them.

The server, though, has no idea that a client request is a result of the user loading the page initially or the client refreshing the page.

A web server serves data. There is no way to make a server push data to a client. You wouldn't want google pushing data to you, would you?

A web client pulls data. It can include, in the GET request, information that the server uses to tailor the returned data. That could mean that the server does something like turning a pin on or off, too.

The server can tell the client, using meta tags, that it needs to check back later. That "check back later" part is a completely separate transaction, though.

i just want to ask if there is a "auto refresh" function for the web browser of your ethernet shield? like i want it to autoamatically refresh it every 5 secs..

pisayjames:
i just want to ask if there is a "auto refresh" function for the web browser of your ethernet shield? like i want it to autoamatically refresh it every 5 secs..

Yes. Web browser implies web client.
http://playground.arduino.cc/Code/WebClient

You can do it with the meta refresh tag on whatever is serving up your HTML pages. Here's what you were asking for, from the wikipedia page on the subject:

<meta http-equiv="refresh" content="5">