Go Down

Topic: plss help about ethernet shield (Read 1 time) previous topic - next topic

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.
I only provide help via the forum - please do not contact me for private consultancy.

pisayjames


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?

PaulS

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


Code: [Select]
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().

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)

Arrch


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:

Quote
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.


Quote
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.

Go Up