ENC28J60 more pins.

I've got code

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

int led1 = 2;
int led2 = 3;
int led3 = 4;
int led4 = 5;


static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24}; // Ethernet Shield MAC Adresse                                                         
static uint8_t ip[4] = {192, 168, 1, 15}; // Webserver IP Adresse                
static uint16_t port = 80; // Webserver Port                                   

ETHER_28J60 e;

void setup()
{ 
  e.setup(mac, ip, port);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
 
        
}

void loop()
{
  
 char* params;
  if (params = e.serviceRequest())
  {
// PIN 2
    e.print("<table border=1><tr><td><b>PIN 2</b></td>");

    if (strcmp(params, "?cmd1=on") == 0)
    {
      digitalWrite(led1, HIGH);
    }
    if (strcmp(params, "?cmd1=off") == 0)
    {
      digitalWrite(led1, LOW);
    }
    
if (digitalRead(led1) == HIGH)
{
  e.print("<td><font color=green>aktiv</font></td>");
   e.print("<td><A HREF='?cmd1=off'>Ausschalten</A></td>");
}
else
{
  e.print("<td><font color=red>inaktiv</font></td>");
  e.print("<td><A HREF='?cmd1=on'>Anschalten</A></td>");
} 

// PIN 3
    e.print("<table border=1><tr><td><b>PIN 3</b></td>");

    if (strcmp(params, "?cmd2=on") == 0)
    {
      digitalWrite(led2, HIGH);
    }
    if (strcmp(params, "?cmd2=off") == 0)
    {
      digitalWrite(led2, LOW);
    }
    
if (digitalRead(led2) == HIGH)
{
  e.print("<td><font color=green>aktiv</font></td>");
   e.print("<td><A HREF='?cmd2=off'>Ausschalten</A></td>");
}
else
{
  e.print("<td><font color=red>inaktiv</font></td>");
  e.print("<td><A HREF='?cmd2=on'>Anschalten</A></td>");
} 

// PIN 4
    e.print("<table border=1><tr><td><b>PIN 4</b></td>");

    if (strcmp(params, "?cmd3=on") == 0)
    {
      digitalWrite(led3, HIGH);
    }
    if (strcmp(params, "?cmd3=off") == 0)
    {
      digitalWrite(led3, LOW);
    }
    
if (digitalRead(led3) == HIGH)
{
  e.print("<td><font color=green>aktiv</font></td>");
   e.print("<td><A HREF='?cmd3=off'>Ausschalten</A></td>");
}
else
{
  e.print("<td><font color=red>inaktiv</font></td>");
  e.print("<td><A HREF='?cmd3=on'>Anschalten</A></td>");
} 

// PIN 4
    e.print("<table border=1><tr><td><b>PIN 5</b></td>");

    if (strcmp(params, "?cmd4=on") == 0)
    {
      digitalWrite(led4, HIGH);
    }
    if (strcmp(params, "?cmd4=off") == 0)
    {
      digitalWrite(led4, LOW);
    }
    
if (digitalRead(led4) == HIGH)
{
  e.print("<td><font color=green>aktiv</font></td>");
   e.print("<td><A HREF='?cmd4=off'>Ausschalten</A></td>");
}
else
{
  e.print("<td><font color=red>inaktiv</font></td>");
  e.print("<td><A HREF='?cmd4=on'>Anschalten</A></td>");
} 



    e.respond();
  }  
}

And my problem is that i don't know how to increase the number of LED's that i can control, because when in code are 3 led's that is ok and it works, but when i increase this number to four or more then Arduino isn't responing. How can i fix it ?

With your style of coding you have to learn about the F() macro: Arduino Playground - Memory

Even better would be to learn about arrays because your complete code will get much shorter and will use much less RAM.
Another example to save some RAM: your LED variables don't have to be integers, a declaration as byte is more than enough.

O.K I know that I don't know much about programming, but that it's nol solvving my problem :slight_smile: Could you give me example of working code which i can use ?

This is the code with an array and using the F() macro, you still have lots of potential for optimizing:

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

byte led[4] = {2, 3, 4, 5};

static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24}; // Ethernet Shield MAC Adresse
static uint8_t ip[4] = {192, 168, 1, 15}; // Webserver IP Adresse                
static uint16_t port = 80; // Webserver Port                                   

byte i;
ETHER_28J60 e;

void setup() {
  e.setup(mac, ip, port);
  for (i = 0; i < 4; i++) {
    pinMode(led[i], OUTPUT);
  }
}

void loop() {
  char* params;
  if (params = e.serviceRequest()) {
    for (i = 0; i < 4; i++) {
      e.print(F("<table border=\"1\"><tr><td><b>PIN "));
      e.print(led[i], DEC);
      e.print(F("</b></td>"));

      if (strncmp(params, "?cmd", 4) == 0 && params[4] - '1' == i) {
        if (strncmp(params+5, "=on", 3) == 0) {
          digitalWrite(led[i], HIGH);
        } else if (strncmp(params+5, "=off", 3) == 0) {
          digitalWrite(led[i], LOW);
        }
      }
      if (digitalRead(led[i]) == HIGH) {
        e.print(F("<td><font color=\"green\">aktiv</font></td>"));
        e.print(F("<td><A HREF=\"?cmd"));
        e.print(i+1, DEC);
        e.print(F("=off\">Ausschalten</A></td>"));
      } else {
        e.print(F("<td><font color=red>inaktiv</font></td>"));
        e.print(F("<td><A HREF='?cmd"));
        e.print(i+1, DEC);
        e.print(F("=on'>Anschalten</A></td>"));
      }
    }
    e.respond();
  }  
}

I don't know why but it's not working. It is giving me an error

sketch_may14a.ino: In function 'void loop()':
sketch_may14a:24: error: invalid conversion from 'const __FlashStringHelper*' to 'int'
sketch_may14a:24: error: initializing argument 1 of 'void ETHER_28J60::print(int)'
sketch_may14a:25: error: no matching function for call to 'ETHER_28J60::print(byte&, int)'
D:\arduino-1.0.4\libraries\ETHER_28J60/ETHER_28J60.h:31: note: candidates are: void ETHER_28J60::print(char*)
D:\arduino-1.0.4\libraries\ETHER_28J60/ETHER_28J60.h:32: note:                 void ETHER_28J60::print(int)
sketch_may14a:26: error: invalid conversion from 'const __FlashStringHelper*' to 'int'
sketch_may14a:26: error: initializing argument 1 of 'void ETHER_28J60::print(int)'
sketch_may14a:36: error: invalid conversion from 'const __FlashStringHelper*' to 'int'
sketch_may14a:36: error: initializing argument 1 of 'void ETHER_28J60::print(int)'
sketch_may14a:37: error: invalid conversion from 'const __FlashStringHelper*' to 'int'
sketch_may14a:37: error: initializing argument 1 of 'void ETHER_28J60::print(int)'
sketch_may14a:38: error: no matching function for call to 'ETHER_28J60::print(int, int)'
D:\arduino-1.0.4\libraries\ETHER_28J60/ETHER_28J60.h:31: note: candidates are: void ETHER_28J60::print(char*)
D:\arduino-1.0.4\libraries\ETHER_28J60/ETHER_28J60.h:32: note:                 void ETHER_28J60::print(int)
sketch_may14a:39: error: invalid conversion from 'const __FlashStringHelper*' to 'int'
sketch_may14a:39: error: initializing argument 1 of 'void ETHER_28J60::print(int)'
sketch_may14a:41: error: invalid conversion from 'const __FlashStringHelper*' to 'int'
sketch_may14a:41: error: initializing argument 1 of 'void ETHER_28J60::print(int)'
sketch_may14a:42: error: invalid conversion from 'const __FlashStringHelper*' to 'int'
sketch_may14a:42: error: initializing argument 1 of 'void ETHER_28J60::print(int)'
sketch_may14a:43: error: no matching function for call to 'ETHER_28J60::print(int, int)'
D:\arduino-1.0.4\libraries\ETHER_28J60/ETHER_28J60.h:31: note: candidates are: void ETHER_28J60::print(char*)
D:\arduino-1.0.4\libraries\ETHER_28J60/ETHER_28J60.h:32: note:                 void ETHER_28J60::print(int)
sketch_may14a:44: error: invalid conversion from 'const __FlashStringHelper*' to 'int'
sketch_may14a:44: error: initializing argument 1 of 'void ETHER_28J60::print(int)'

What should i change ?

It looks like your library does not inherit the print() functionality from the Print class of the Arduino framework, so the F() macro does not work. Remove the F() calls and it probably compiles.

Example:

e.print(F("<table border=\"1\"><tr><td><b>PIN "));

gets

e.print("<table border=\"1\"><tr><td><b>PIN ");

Unfortunatelly it still doesn't work, it gives me an error's especialy
note: candidates are: void ETHER_28J60::print(char*)
note: void ETHER_28J60::print(int)

I don't know what is wrong.

Have you replaced all lines with the F() macro or just the line I gave you as an example? Post the code you're trying to compile.

Yes, I replaced all lines, but it still don't work

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

byte led[4] = {2, 3, 4, 5};

static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24}; // Ethernet Shield MAC Adresse
static uint8_t ip[4] = {192, 168, 1, 15}; // Webserver IP Adresse                
static uint16_t port = 80; // Webserver Port                                   

byte i;
ETHER_28J60 e;

void setup() {
  e.setup(mac, ip, port);
  for (i = 0; i < 4; i++) {
    pinMode(led[i], OUTPUT);
  }
}

void loop() {
  char* params;
  if (params = e.serviceRequest()) {
    for (i = 0; i < 4; i++) {
      e.print("<table border=\"1\"><tr><td><b>PIN ");
      e.print(led[i], DEC);
      e.print("</b></td>");

      if (strncmp(params, "?cmd", 4) == 0 && params[4] - '1' == i) {
        if (strncmp(params+5, "=on", 3) == 0) {
          digitalWrite(led[i], HIGH);
        } else if (strncmp(params+5, "=off", 3) == 0) {
          digitalWrite(led[i], LOW);
        }
      }
      if (digitalRead(led[i]) == HIGH) {
        e.print("<td><font color=\"green\">aktiv</font></td>");
        e.print("<td><A HREF=\"?cmd");
        e.print(i+1, DEC);
        e.print("=off\">Ausschalten</A></td>");
      } else {
        e.print("<td><font color=red>inaktiv</font></td>");
        e.print("<td><A HREF='?cmd"));
        e.print(i+1, DEC);
        e.print("=on'>Anschalten</A></td>");
      }
    }
    e.respond();
  }  
}

I found it, the rather minimal print implementation of the library you used has another limitation. Remove the ", DEC" from the integer prints, e.g.:

 e.print(led[i], DEC);

becomes

 e.print(led[i]);

Do that for all occurrences.

I don't know what is wrong, because code works but only for 3 LED's, when i increase number to 4, it stops working.

Final code:

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

byte led[4] = {2, 3, 4};

static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24}; // Ethernet Shield MAC Adresse
static uint8_t ip[4] = {192, 168, 1, 15}; // Webserver IP Adresse                
static uint16_t port = 80; // Webserver Port                                   

byte i;
ETHER_28J60 e;

void setup() {
  e.setup(mac, ip, port);
  for (i = 0; i < 3; i++) {
    pinMode(led[i], OUTPUT);
  }
}

void loop() {
  char* params;
  if (params = e.serviceRequest()) {
    for (i = 0; i < 3; i++) {
      e.print("<table border=\"1\"><tr><td><b>PIN ");
       e.print(led[i]);
      e.print("</b></td>");

      if (strncmp(params, "?cmd", 4) == 0 && params[4] - '1' == i) {
        if (strncmp(params+5, "=on", 3) == 0) {
          digitalWrite(led[i], HIGH);
        } else if (strncmp(params+5, "=off", 3) == 0) {
          digitalWrite(led[i], LOW);
        }
      }
      if (digitalRead(led[i]) == HIGH) {
        e.print("<td><font color=\"green\">aktiv</font></td>");
        e.print("<td><A HREF=\"?cmd");
        e.print(i+1);
        e.print("=off\">Ausschalten</A></td>");
      } else {
        e.print("<td><font color=red>inaktiv</font></td>");
        e.print("<td><A HREF='?cmd");
        e.print(i+1);
        e.print("=on'>Anschalten</A></td>");
      }
    }
    e.respond();
  }  
}

What does "stops working" mean? Does it stop compiling? Have you checked with different LED pins? Is it possible that pin 5 is used for connecting the 28J60?

I mean it won't work at all, when i load instruction for 3 led's it normally shows me website with 3 buttons, when i load instruction for 4 led's it's not even start, led's on arduino are blinking but in browser i see only no connection error 404, i don't use any pins because enc using pins 10,11,12 and 13, i was trying to change them but it is not changing anything.

Which 28J60 library are you using? Please provide a link to it.

http://trollmaker.com/article11/arduino-1-0-with-enc28j60-ethernet-shield-v1-1

The problem is that the buffer of the library is 500 bytes. The HTML code for one LED is about 125 bytes. Together with some inserted header you overrun the buffer with 4 LEDs.

But it looks like you can insert the e.respond() several times (I just looked over it very shortly), so try moving that line up by one line, so it gets inside the loop over the LEDs.

I've moved e.respond line up but it still doesn't work

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

byte led[4] = {2, 3, 4, 5};

static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24}; // Ethernet Shield MAC Adresse
static uint8_t ip[4] = {192, 168, 1, 15}; // Webserver IP Adresse                
static uint16_t port = 80; // Webserver Port                                   

byte i;
ETHER_28J60 e;

void setup() {
  e.setup(mac, ip, port);
  for (i = 0; i < 4; i++) {
    pinMode(led[i], OUTPUT);
  }
}

void loop() {
  char* params;
  if (params = e.serviceRequest()) {
    for (i = 0; i < 4; i++) {
      e.print("<table border=\"1\"><tr><td><b>PIN ");
      e.print(led[i]);
      e.print("</b></td>");

      if (strncmp(params, "?cmd", 4) == 0 && params[4] - '1' == i) {
        if (strncmp(params+5, "=on", 3) == 0) {
          digitalWrite(led[i], HIGH);
        } else if (strncmp(params+5, "=off", 3) == 0) {
          digitalWrite(led[i], LOW);
        }
      }
      if (digitalRead(led[i]) == HIGH) {
        e.print("<td><font color=\"green\">aktiv</font></td>");
        e.print("<td><A HREF=\"?cmd");
        e.print(i+1);
        e.print("=off\">Ausschalten</A></td>");
      } else {
        e.print("<td><font color=red>inaktiv</font></td>");
        e.print("<td><A HREF='?cmd");
        e.print(i+1);
        e.print("=on'>Anschalten</A></td>");
        e.respond();
      }
    } 
  }  
}

I was even trying with a few e.respond in few places but it doesn't work. I don't know what to do.

You moved it up one line too much. Try this version:

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

byte led[4] = {2, 3, 4, 5};

static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24}; // Ethernet Shield MAC Adresse
static uint8_t ip[4] = {192, 168, 1, 15}; // Webserver IP Adresse                
static uint16_t port = 80; // Webserver Port                                   

byte i;
ETHER_28J60 e;

void setup() {
  e.setup(mac, ip, port);
  for (i = 0; i < 4; i++) {
    pinMode(led[i], OUTPUT);
  }
}

void loop() {
  char* params;
  if (params = e.serviceRequest()) {
    for (i = 0; i < 4; i++) {
      e.print("<table border=\"1\"><tr><td><b>PIN ");
      e.print(led[i]);
      e.print("</b></td>");

      if (strncmp(params, "?cmd", 4) == 0 && params[4] - '1' == i) {
        if (strncmp(params+5, "=on", 3) == 0) {
          digitalWrite(led[i], HIGH);
        } else if (strncmp(params+5, "=off", 3) == 0) {
          digitalWrite(led[i], LOW);
        }
      }
      if (digitalRead(led[i]) == HIGH) {
        e.print("<td><font color=\"green\">aktiv</font></td>");
        e.print("<td><A HREF=\"?cmd");
        e.print(i+1);
        e.print("=off\">Ausschalten</A></td>");
      } else {
        e.print("<td><font color=red>inaktiv</font></td>");
        e.print("<td><A HREF='?cmd");
        e.print(i+1);
        e.print("=on'>Anschalten</A></td>");
      }
      e.respond();
    } 
  }  
}

sorry but it still doesn't work :frowning:

I've got code

#include "etherShield.h"


// please modify the following two lines. mac and ip have to be unique
// in your local area network. You can not have the same numbers in
// two devices:
static uint8_t mymac[6] = {0x54,0x55,0x58,0x10,0x00,0x24}; 
static uint8_t myip[4] = {192,168,1,15};
static char baseurl[]="http://192.168.1.15/";
static uint16_t mywwwport =80; // listen port for tcp/www (max range 1-254)



#define BUFFER_SIZE 500
static uint8_t buf[BUFFER_SIZE+1];
#define STR_BUFFER_SIZE 22
static char strbuf[STR_BUFFER_SIZE+1];

EtherShield es=EtherShield();

// prepare the webpage by writing the data to the tcp send buffer
uint16_t print_webpage(uint8_t *buf, byte on_off);
int8_t analyse_cmd(char *str);

// LED cathode connects the Pin4, anode to 5V through 1K resistor
#define LED_PIN  4


void setup(){
  
   /*initialize enc28j60*/
	 es.ES_enc28j60Init(mymac);
   es.ES_enc28j60clkout(2); // change clkout from 6.25MHz to 12.5MHz
   delay(10);
        
	/* Magjack leds configuration, see enc28j60 datasheet, page 11 */
	// LEDA=greed LEDB=yellow
	//
	// 0x880 is PHLCON LEDB=on, LEDA=on
	// enc28j60PhyWrite(PHLCON,0b0000 1000 1000 00 00);
	es.ES_enc28j60PhyWrite(PHLCON,0x880);
	delay(500);
	//
	// 0x990 is PHLCON LEDB=off, LEDA=off
	// enc28j60PhyWrite(PHLCON,0b0000 1001 1001 00 00);
	es.ES_enc28j60PhyWrite(PHLCON,0x990);
	delay(500);
	//
	// 0x880 is PHLCON LEDB=on, LEDA=on
	// enc28j60PhyWrite(PHLCON,0b0000 1000 1000 00 00);
	es.ES_enc28j60PhyWrite(PHLCON,0x880);
	delay(500);
	//
	// 0x990 is PHLCON LEDB=off, LEDA=off
	// enc28j60PhyWrite(PHLCON,0b0000 1001 1001 00 00);
	es.ES_enc28j60PhyWrite(PHLCON,0x990);
	delay(500);
	//
  // 0x476 is PHLCON LEDA=links status, LEDB=receive/transmit
  // enc28j60PhyWrite(PHLCON,0b0000 0100 0111 01 10);
  es.ES_enc28j60PhyWrite(PHLCON,0x476);
	delay(100);
        
  //init the ethernet/ip layer:
  es.ES_init_ip_arp_udp_tcp(mymac,myip,80);
  
 	pinMode(LED_PIN, OUTPUT); 
 	digitalWrite(LED_PIN, LOW);  // switch on LED
}

void loop(){
  uint16_t plen, dat_p;
  int8_t cmd;
  byte on_off = 1;

  plen = es.ES_enc28j60PacketReceive(BUFFER_SIZE, buf);

	/*plen will ne unequal to zero if there is a valid packet (without crc error) */
  if(plen!=0){
	           
    // arp is broadcast if unknown but a host may also verify the mac address by sending it to a unicast address.
    if(es.ES_eth_type_is_arp_and_my_ip(buf,plen)){
      es.ES_make_arp_answer_from_request(buf);
      return;
    }

    // check if ip packets are for us:
    if(es.ES_eth_type_is_ip_and_my_ip(buf,plen)==0){
      return;
    }
    
    if(buf[IP_PROTO_P]==IP_PROTO_ICMP_V && buf[ICMP_TYPE_P]==ICMP_TYPE_ECHOREQUEST_V){
      es.ES_make_echo_reply_from_request(buf,plen);
      return;
    }
    
    // tcp port www start, compare only the lower byte
    if (buf[IP_PROTO_P]==IP_PROTO_TCP_V&&buf[TCP_DST_PORT_H_P]==0&&buf[TCP_DST_PORT_L_P]==mywwwport){
      if (buf[TCP_FLAGS_P] & TCP_FLAGS_SYN_V){
         es.ES_make_tcp_synack_from_syn(buf); // make_tcp_synack_from_syn does already send the syn,ack
         return;     
      }
      if (buf[TCP_FLAGS_P] & TCP_FLAGS_ACK_V){
        es.ES_init_len_info(buf); // init some data structures
        dat_p=es.ES_get_tcp_data_pointer();
        if (dat_p==0){ // we can possibly have no data, just ack:
          if (buf[TCP_FLAGS_P] & TCP_FLAGS_FIN_V){
            es.ES_make_tcp_ack_from_any(buf);
          }
          return;
        }
        if (strncmp("GET ",(char *)&(buf[dat_p]),4)!=0){
          	// head, post and other methods for possible status codes see:
            // http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
            plen=es.ES_fill_tcp_data_p(buf,0,PSTR("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n<h1>200 OK</h1>"));
            goto SENDTCP;
        }
 	if (strncmp("/ ",(char *)&(buf[dat_p+4]),2)==0){
                plen=print_webpage(buf, on_off);
            goto SENDTCP;
         }
        cmd=analyse_cmd((char *)&(buf[dat_p+5]));
        
        if (cmd==2){
                on_off=1;
        	digitalWrite(LED_PIN, LOW);  // switch on LED
        }
        else if (cmd==3){
                on_off=0;
        	digitalWrite(LED_PIN, HIGH);  // switch off LED
        }
        plen=print_webpage(buf, on_off);
        	
        	   plen=print_webpage(buf, on_off);
SENDTCP:  es.ES_make_tcp_ack_from_any(buf); // send ack for http get
           es.ES_make_tcp_ack_with_data(buf,plen); // send data       
      }
    }
  }
        
}
// The returned value is stored in the global var strbuf
uint8_t find_key_val(char *str,char *key)
{
        uint8_t found=0;
        uint8_t i=0;
        char *kp;
        kp=key;
        while(*str &&  *str!=' ' && found==0){
                if (*str == *kp){
                        kp++;
                        if (*kp == '\0'){
                                str++;
                                kp=key;
                                if (*str == '='){
                                        found=1;
                                }
                        }
                }else{
                        kp=key;
                }
                str++;
        }
        if (found==1){
                // copy the value to a buffer and terminate it with '\0'
                while(*str &&  *str!=' ' && *str!='&' && i<STR_BUFFER_SIZE){
                        strbuf[i]=*str;
                        i++;
                        str++;
                }
                strbuf[i]='\0';
        }
        return(found);
}

int8_t analyse_cmd(char *str)
{
        int8_t r=-1;
     
        if (find_key_val(str,"cmd")){
                if (*strbuf < 0x3a && *strbuf > 0x2f){
                        // is a ASCII number, return it
                        r=(*strbuf-0x30);
                }
        }
        return r;
}


uint16_t print_webpage(uint8_t *buf, byte on_off)
{

       int i=0;
    
        
        uint16_t plen;
        
 
        
        plen=es.ES_fill_tcp_data_p(buf,0,PSTR("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n"));
        plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<center><p><h1>Welcome to Arduino Ethernet Shield V1.0  </h1></p> "));
         
        plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<hr>
<form METHOD=get action=\""));
        plen=es.ES_fill_tcp_data(buf,plen,baseurl);
        plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("\">"));
        plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<h2> REMOTE LED is  </h2> "));
 				plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<h1><font color=\"#00FF00\"> "));
         
        if(on_off)
        	plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("ON"));
        else 
        	plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("OFF"));
        
        plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("  </font></h1>
 ") );
        
        if(on_off){
        	plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<input type=hidden name=cmd value=3>"));
        	plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<input type=submit value=\"Switch off\"></form>"));
        }
        else {
        	plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<input type=hidden name=cmd value=2>"));
        	plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("<input type=submit value=\"Switch on\"></form>"));
        }
        
        plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("</center><hr> <p> V1.0 <a href=\"http://www.nuelectronics.com\">www.nuelectronics.com<a>"));
  
        return(plen);
}

Is it possible to modify it and control more led's and is it will work properly ?