Arduino + Ethernet shield IO on/off

Hello.

I have been now thinking this for a while. (couple of months)
The problem is that the pin control is working kinda okay, but when you refresh the page from other computer, it will ofc start from the begin of the code and it will mess all settings what i did from other computer.
So the guestion is, how i can do the code that way it will save the setup what i do from another computer, and when refresh the site from other computer, it will show up the last setups that i did from another computer. Do i need php and mysql with it? I have it connected to server pc where can be installed LAMP or whatever is needed. I am doing little home automation with this, but first i need to get it to remember settings when u submit it and open anywhere else.

I took the test code from some site and trying to get that remember the setups.
Here is the code: http://paste.servut.us/9c1h
Basic idea is create easy and reliable way to switch outputs on/off.

Sorry for bad english, and thanks for your respond, all knowledge is needed! :slight_smile:
Really struggling with this :confused:

-Dworf

You are connecting to the Arduino from two computers, and you want the same information returned to each computer? That's easy.

Or you want the Arduino to remember which client it was talking to, and respond to that client? That's impossible.

Arduino is connected to my server pc (with usb to get power) and with rj45 to router.

It is acting as webserver and i can connect atm from local network to it.
I want, when i change for example the output pin 5 ON from first pc, it will remember that choise, and when i connect to it with second pc from local network, it will show u the changes what been made from first computer, and again when you change something more from second pc, u will show the changes with first pc too.

For now its doing like this:
First pc i put led on from pin 5.
And the led will lights up.
When i connect from second pc to arduino webserver it will put led off from pin 5, as it should stay up, and go off only if i change it off.

So, i need to get it to remember my choice from first pc and show the site as it is to second pc, not "reset" all.
cause thats the point of controlling it from web(that u can connect with any device to it and show the atm status.), not reseting all when u connect to it.

Did you got it? :stuck_out_tongue:

I want, when i change for example the output pin 5 ON from first pc, it will remember that choise, and when i connect to it with second pc from local network, it will show u the changes what been made from first computer, and again when you change something more from second pc, u will show the changes with first pc too.

Forget about “first PC” and “second PC”. The Arduino does. Think more like the Arduino - some random client.

If you want each client to see the current state of affairs, you must program the Arduino to report the current state of affairs (whatever that means) to each client, whenever a client requests the web page.

You can not make the Arduino send updates to every client that has ever accessed it. You must, instead, make every client ask again, periodically. This can be done by setting the refresh rate in the meta data in the web page that is sent.

Add “” (or whatever the correct URL is) to the we page, between the and tags.

This does not guarantee that each client will honor the refresh rate information, and request data at that rate, but it is the only thing that you can do on the server to inform a client that the data that it just received is subject to change.

So, i need to get it to remember my choice from first pc and show the site as it is to second pc, not “reset” all.

If the Arduino is resetting anything, the code is not written correctly.