I have already built a small Web server on my arduino uno+ enc28j60 module with EtherCard Library. But can I add the capability to control some I/O pins on my arduino using the same webpage? how can I do that.. please help..
But can I add the capability to control some I/O pins on my arduino using the same webpage?
Of course. The page you serve up must contain a form with input fields of some sort (radio buttons and check boxes are useful), along with a submit button.
The submit button will cause a modified request to be sent to the server.
On the server, you need to distinguish between a request for the form in the first place (no ? followed by other data) and a request containing additional data (there is a ? followed by additional data). Parse that additional data to determine what the client wants the server to do.
Thanx PaulS...
but its little confusing. If you can show me a small, example that would be a great help..!!
If you can show me a small, example that would be a great help.
I don't have the same ethernet card that you do, so I really can't help you.
ok then.. but can you just give an example about d http part..its common for any ethernet card i guess ... its a big help for me now..
This isn't using your library, its using this one:
void loop()
{
char* params;
if (params = e.serviceRequest())
{
e.print("<H1>Web Remote</H1>");
if (strcmp(params, "?cmd=on") == 0)
{
digitalWrite(outputPin, HIGH);
e.print("<A HREF='?cmd=off'>Turn off</A>");
}
else
{
digitalWrite(outputPin, LOW);
e.print("<A HREF='?cmd=on'>Turn on</A>");
}
e.respond();
}
}
Hi Simon,
Is your library still undergoing developments ? The link above is date March 2010.
Did you ever look at EtherCard ? I'm currently trying (with some others) to understand it, but it's not trivial !