I need typical example "activating led" through web but the UIPEthernet library

I have a rookie question, I am newbie with arduino, normally I can find the code to run my program, but I've found a little problem that I can not fix (sure is very easy), I can not find a typical example of activating led through web but with the UIPEthernet library .

Could you show me a basic example with your library?

Thank you very very much.

(Sorry for my bad Engish)

but with the UIPEthernet library .

Do you have a link to this library?

alexiter:
I have a rookie question, I am newbie with arduino, normally I can find the code to run my program, but I've found a little problem that I can not fix (sure is very easy), I can not find a typical example of activating led through web but with the UIPEthernet library .

Could you show me a basic example with your library?

The website (GitHub - ntruchsess/arduino_uip: UIPEthernet: A plugin-replacement of the stock Arduino Ethernet library for ENC28J60 shields and breakout boards. Full support for persistent (streaming) TCP-connections and UDP (Client and Server each), ARP, ICMP, DHCP and DNS. Build around Adam Dunkels uIP Stack. Further developed version can be found on https://github.com/UIPEthernet/UIPEthernet) says:
"UIPEthernet: A plugin-replacement of the stock Arduino Ethernet library for ENC28J60 shields and breakout boards. Full support for persistent (streaming) TCP-connections and UDP (Client and Server each), ARP, ICMP, DHCP and DNS. Build around Adam Dunkels uIP Stack."

From that it looks like any examples you can find for the Arduino Ethernet Library should work with the UIPEthernet Library.

PaulS:

but with the UIPEthernet library .

Do you have a link to this library?

johnwasser:

alexiter:
I have a rookie question, I am newbie with arduino, normally I can find the code to run my program, but I've found a little problem that I can not fix (sure is very easy), I can not find a typical example of activating led through web but with the UIPEthernet library .

Could you show me a basic example with your library?

The website (GitHub - ntruchsess/arduino_uip: UIPEthernet: A plugin-replacement of the stock Arduino Ethernet library for ENC28J60 shields and breakout boards. Full support for persistent (streaming) TCP-connections and UDP (Client and Server each), ARP, ICMP, DHCP and DNS. Build around Adam Dunkels uIP Stack. Further developed version can be found on https://github.com/UIPEthernet/UIPEthernet) says:
"UIPEthernet: A plugin-replacement of the stock Arduino Ethernet library for ENC28J60 shields and breakout boards. Full support for persistent (streaming) TCP-connections and UDP (Client and Server each), ARP, ICMP, DHCP and DNS. Build around Adam Dunkels uIP Stack."

From that it looks like any examples you can find for the Arduino Ethernet Library should work with the UIPEthernet Library.

I´m sure, but my problem is with this code:

#include "etherShield.h"
#include "ETHER_28J60.h"
#define RELAY1  5
#define RELAY2  4

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, 5}; // IP address for the webserver

static uint16_t port = 85; // Use port 80 – the standard for HTTP  MAX port is 240.

ETHER_28J60 e;


void setup()
{
e.setup(mac, ip, port);
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);
digitalWrite(RELAY1,HIGH);
digitalWrite(RELAY2,HIGH);
}

void loop()
{
char* params;
if (params = e.serviceRequest())
{
if (strcmp(params, "?led1=on&led2=off") == 0)
{
pinMode(RELAY1, HIGH);
pinMode(RELAY2, LOW);
delay(1000);
pinMode(RELAY1, LOW);

}
else if (strcmp(params, "?led1=off&led2=on") == 0)
{
pinMode(RELAY1, LOW);
pinMode(RELAY2, HIGH);
delay(1000);
pinMode(RELAY2, LOW);

}
else if (strcmp(params, "?led1=off&led2=off") == 0)
{
pinMode(RELAY1, LOW);
pinMode(RELAY2, LOW);

}
else if (strcmp(params, "?led1=on&led2=on") == 0)
{
pinMode(RELAY1, HIGH);

}
e.print("<!DOCTYPE html>");
e.print("<html>");
e.print("<head>");
if (strcmp(params, "?led1=on&led2=off") == 0)
{
e.print("<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"3;URL=index.html\">");
}
if (strcmp(params, "?led1=off&led2=on") == 0)
{
e.print("<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"5;URL=index.html\">");
}
if (strcmp(params, "?led1=on&led2=on") == 0)
{
e.print("<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"7;URL=?led1=off&led2=off\">");
}
e.print("<title>System Control</title>");
e.print("<link rel='stylesheet' href='http://act.con-ip.com/a/estilo.css'>");
if (strcmp(params, "?led1=off&led2=on") == 0)
{
e.print("<script type='text/javascript' src='http://act.con-ip.com/a/funcionR.js'></script>");
} else {
e.print("<script type='text/javascript' src='http://act.con-ip.com/a/funcion.js'></script>");  
} 
e.print("</head>");
e.print("<body style='background-color: #DEDEDE' onload='carga();' >");
e.print("<input id='vol' type='hidden' value='");
e.print(map(analogRead(1), 0, 1024, 0, 120));
e.print("'>");
e.print("<div id='contenido' class='b4' >");

e.print("</div>");

e.print("</body>");
e.print("</html>");
e.respond();
}
}

What I have to modify to work with UIPEthernet?

Thanks.

The author of the library has helped me.

http://forum.arduino.cc/index.php?topic=178024.165

Thank you all for the help. :slight_smile: