Problema de copilacion con libreria WEBDUINO

Buenos dias, Inicialmente me gustaria agradecer a toda esta maravillosa comunidad por su gentileza al momento de compartir ideas y ayudar a otros y expresarles mi mas sincero agradecimiento.

El problema es el siguiente, estoy intentando experimentar sobre la creacion de un pequeño sistema domotico con control de acceso, he copiado un codigo desde internet, Anexo link del autor y he intentado reproducirlo, ya he adicionado la libreria externa WEBDUINO, sin embargo al momento de verificar el codigo el copilador me indica errores, seria de gran ayuda entender cual seria el problema ya que no soy muy experto en tramas de comunicacion HTTP ni del lengauje

#include <SPI.h>
#include <Ethernet.h>
#include <WebServer.h>


	/* you can change the authentication realm by defining

	 * WEBDUINO_AUTH_REALM before including WebServer.h */

	#define WEBDUINO_AUTH_REALM "Igua Private Site"

	 

	#define Host_name "Igua"

	 

	
	 

	/* CHANGE THIS TO YOUR OWN UNIQUE VALUE.  The MAC number should be

	 * different from any other devices on your network or you'll have

	 * problems receiving packets. */

	byte mac[] = { 0x16, 0x16, 0x16, 0x16, 0x16, 0x01 };

	 

	/* CHANGE THIS TO MATCH YOUR HOST NETWORK.  Most home networks are in

	 * the 192.168.0.XXX or 192.168.1.XXX subrange.  Pick an address

	 * that's not in use and isn't going to be automatically allocated by

	 * DHCP from your router. */

	IPAddress ip(192,168,0,5);

	IPAddress gateway(192,168,0,5);

	IPAddress subnet(255, 255, 255, 0);

	 

	/* This creates an instance of the webserver.  By specifying a prefix

	 * of "", all pages will be at the root of the server. */

	#define PREFIX ""

	WebServer webserver(PREFIX, 80);

	 

	boolean LED_status = 0;   // state of LED, off by default

	 

	// ROM-based messages used by the application

	// These are needed to avoid having the strings use up our limited

	// amount of RAM.

	 

	P(Page_start) = "<html><head><title>ManchiHouse</title></head><body>\n";

	P(Page_end) = "</body></html>";

	P(Get_head) = "<h1>GET from ";

	P(Post_head) = "<h1>POST to ";

	P(Unknown_head) = "<h1>UNKNOWN request for ";

	P(Default_head) = "unidentified URL requested.</h1>
\n";

	P(Line_break) = "
\n";

	P(Form_Inicio) = "<form method=\"get\">";

	P(Form_Final) = "</form>";

	 

	#define NAMELEN 32

	#define VALUELEN 32

	 

	String GetParam(String ParamName, WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete)

	{

	  URLPARAM_RESULT rc;

	  char name[NAMELEN];

	  char value[VALUELEN];

	  String ReturnParam = "";

	  if (strlen(url_tail))

	    {

	    while (strlen(url_tail))

	      {

	      rc = server.nextURLparam(&url_tail, name, NAMELEN, value, VALUELEN);

	      if (rc != URLPARAM_EOS && String(name) == ParamName)

	        {

	        ReturnParam = value;

	        }

	      }

	    }

	  if (type == WebServer::POST)

	  {

	    while (server.readPOSTparam(name, NAMELEN, value, VALUELEN))

	    {

	      if (String(name) == ParamName)

	      {

	        ReturnParam = value;

	      }

	    }

	  }

	 

	  return ReturnParam;

	}

	 

	//Se mira la query para ver si se ha de activar o desactivar la linea

	String ProcesarCheckbox(String Estado)

	{

	  LED_status = 0;

	  if (Estado == "1")

	  {

	    LED_status = true;

	  }

	 

	    if (LED_status) {    // switch LED on

	        digitalWrite(2, HIGH);

	        // checkbox is checked

	        return "<input type=\"checkbox\" name=\"Luz\" value=\"1\" onclick=\"submit();\" checked>Apagar Luz";

	    }

	    else {              // switch LED off

	        digitalWrite(2, LOW);

	        // checkbox is unchecked

	        return "<input type=\"checkbox\" name=\"Luz\" value=\"1\" onclick=\"submit();\">Encender Luz";

	    }

	}

	 

	void indexCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete)

	{

	  server.httpSuccess();

	  if (type != WebServer::HEAD)

	  {

	    P(Saludo) = "<h1>Bienvenido a IGUA!</h1><a href=\"control.html\">Acceder</a>";

	    server.printP(Saludo);

	  }

	}

	 

	void controlCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete)

	{

	  /* if the user has requested this page using the following credentials

	   * username = user

	   * password = user

	   * display a page saying "Hello User"

	   *

	   * the credentials have to be concatenated with a colon like

	   * username:password

	   * and encoded using Base64 - this should be done outside of your Arduino

	   * to be easy on your resources

	   *

	   * in other words: "YWRtaW46YWRtaW4=" is the Base64 representation of "admin:admin"

	   *

	   * if you need to change the username/password dynamically please search

	   * the web for a Base64 library */

	  if (server.checkCredentials("YWRtaW46YWRtaW4="))

	  {

	    server.httpSuccess();

	    String Estado = GetParam("Luz", server, type, url_tail, tail_complete);

	 

	    if (type != WebServer::HEAD)

	    {

	      P(Control_Head) = "<h1>Bienvenido al control de IGUA</h1><p>Indica si deseas encender o apagar la luz</p>";

	 

	      server.printP(Control_Head);

	      server.printP(Form_Inicio);

	      server.println(ProcesarCheckbox(Estado));

	      server.printP(Form_Final);

	    }

	  }

	  else

	  {

	    Serial.println("No valido");

	    /* send a 401 error back causing the web browser to prompt the user for credentials */

	    server.httpUnauthorized();

	  }

	}

	 

	void failCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete)

	{

	  //this line sends the "HTTP 400 - Bad Request" headers back to the browser

	  server.httpFail();

	 

	   /* if we're handling a GET or POST, we can output our data here.

	    For a HEAD request, we just stop after outputting headers. */

	    if (type== WebServer::HEAD)

	    {

	      return;

	    }

	 

	    server.printP(Page_start);

	 

	    switch(type)

	    {

	      case WebServer::GET:

	      {

	        server.printP(Get_head);

	        break;

	      }

	      case WebServer::POST:

	      {

	        server.printP(Post_head);

	        break;

	      }

	      default:

	      {

	        server.printP(Unknown_head);

	      }

	    }

	    server.printP(Default_head);

	    server.print(url_tail);

	    server.printP(Page_end);

	 

	}

	 

	void setup()

	{

	  Serial.begin(9600);

	  Serial.println("Iniciado");

	 

	  /* initialize the Ethernet adapter */

	  //Ethernet.begin(mac, ip, gateway, subnet);

	 

	  Serial.println("Trying to get an IP address using DHCP");

	  if (Ethernet.begin(mac) == 0) {

	    Serial.println("Failed to configure Ethernet using DHCP");

	    // initialize the ethernet device not using DHCP:

	    Ethernet.begin(mac, ip, gateway, subnet);

	  }

	  // print your local IP address:

	  Serial.print("My IP address: ");

	  ip = Ethernet.localIP();

	  for (byte thisByte = 0; thisByte < 4; thisByte++) {

	    // print the value of each byte of the IP address:

	    Serial.print(ip[thisByte], DEC);

	    Serial.print(".");

	  }

	  Serial.println();

	 

	  /* setup our default command that will be run when the user accesses

	  * the root page on the server */

	  webserver.setDefaultCommand(&indexCmd);

	 

	  /* setup our default command that will be run when the user accesses

	  * a page NOT on the server */

	  //webserver.setFailureCommand(&failCmd);

	 

	  /* run the same command if you try to load /index.html, a common

	  * default page name */

	  webserver.addCommand("index.html", &indexCmd);

	 

	  webserver.addCommand("control.html", &controlCmd);

	 

	  /* start the webserver */

	  webserver.begin();

	 

	  /*Indicamos que el PIN 2 será de salida

	  * para nosotros es donde estará el cable de Luz */

	  pinMode(2, OUTPUT);

	}

	 

	void loop()

	{

	  char buff[64];

	  int len = 64;

	 

	  /* process incoming connections one at a time forever */

	  webserver.processConnection(buff, &len);

	}

HTML.

Pagina Autor

Muchas gracias.

Disculpen el doble post no me quiso aceptar el codigo del error en el mensaje anterior

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: "Arduino Mega 2560 or Mega ADK"
In file included from n.n.ino:4:
C:\Program Files\Arduino\libraries\webduino-1.7/WebServer.h: In member function 'int WebServer::read()':
C:\Program Files\Arduino\libraries\webduino-1.7/WebServer.h:647: error: ambiguous overload for 'operator==' in '((WebServer*)this)->WebServer::m_client == 0'
C:\Program Files\Arduino\libraries\webduino-1.7/WebServer.h:647: note: candidates are: operator==(int, int) <built-in>
C:\Program Files\Arduino\arduino-1.0.6\libraries\Ethernet/EthernetClient.h:27: note:                 virtual bool EthernetClient::operator==(const EthernetClient&)

Estas usando IDE 1.0.6 prueba con 1.6.0 en adelante y tal vez no tengas ese problema.

Muchas gracias por responde, he cambiado de computadora a una con el arduino version 1.6.1 y he compilado el codigo anterior, el resultado ha sido nuevamente un error.

Error:

Arduino:1.6.1 (Windows 7), Placa:"Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:195:21: error: 'prog_char' does not name a type

   void printP(const prog_char *str) { printP((prog_uchar*)str); }

                     ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:195:32: error: ISO C++ forbids declaration of 'str' with no type [-fpermissive]

   void printP(const prog_char *str) { printP((prog_uchar*)str); }

                                ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:195:8: error: 'void WebServer::printP(const int*)' cannot be overloaded

   void printP(const prog_char *str) { printP((prog_uchar*)str); }

        ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:192:8: error: with 'void WebServer::printP(const int*)'

   void printP(const prog_uchar *str);

        ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:198:21: error: 'prog_uchar' does not name a type

   void writeP(const prog_uchar *data, size_t length);

                     ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:198:33: error: ISO C++ forbids declaration of 'data' with no type [-fpermissive]

   void writeP(const prog_uchar *data, size_t length);

                                 ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h: In member function 'void WebServer::printP(const int*)':

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:195:47: error: 'prog_uchar' was not declared in this scope

   void printP(const prog_char *str) { printP((prog_uchar*)str); }

                                               ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:195:58: error: expected primary-expression before ')' token

   void printP(const prog_char *str) { printP((prog_uchar*)str); }

                                                          ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h: At global scope:

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:377:30: error: 'prog_uchar' does not name a type

 void WebServer::writeP(const prog_uchar *data, size_t length)

                              ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:377:42: error: ISO C++ forbids declaration of 'data' with no type [-fpermissive]

 void WebServer::writeP(const prog_uchar *data, size_t length)

                                          ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:399:30: error: 'prog_uchar' does not name a type

 void WebServer::printP(const prog_uchar *str)

                              ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:399:42: error: ISO C++ forbids declaration of 'str' with no type [-fpermissive]

 void WebServer::printP(const prog_uchar *str)

                                          ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h: In member function 'void WebServer::httpFail()':

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:126:32: error: 'prog_uchar' does not name a type

 #define P(name)   static const prog_uchar name[] PROGMEM

                                ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:552:3: note: in expansion of macro 'P'

   P(failMsg) =

   ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:559:10: error: 'failMsg' was not declared in this scope

   printP(failMsg);

          ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h: In member function 'void WebServer::noRobots(WebServer::ConnectionType)':

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:126:32: error: 'prog_uchar' does not name a type

 #define P(name)   static const prog_uchar name[] PROGMEM

                                ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:575:5: note: in expansion of macro 'P'

     P(allowNoneMsg) = "User-agent: *" CRLF "Disallow: /" CRLF;

     ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:576:12: error: 'allowNoneMsg' was not declared in this scope

     printP(allowNoneMsg);

            ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h: In member function 'void WebServer::favicon(WebServer::ConnectionType)':

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:126:32: error: 'prog_uchar' does not name a type

 #define P(name)   static const prog_uchar name[] PROGMEM

                                ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:585:5: note: in expansion of macro 'P'

     P(faviconIco) = WEBDUINO_FAVICON_DATA;

     ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:586:12: error: 'faviconIco' was not declared in this scope

     writeP(faviconIco, sizeof(faviconIco));

            ^

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h: In member function 'void WebServer::httpUnauthorized()':

C:\Users\Bold\Documents\Arduino\libraries\webduino-1.7/WebServer.h:126:32: error: 'prog_uchar' does not name a type

Continua.

Esto compila bien

#include <SPI.h>
#include <Ethernet.h>
#include <WebServer.h>

/* you can change the authentication realm by defining
* WEBDUINO_AUTH_REALM before including WebServer.h */
#define WEBDUINO_AUTH_REALM "Igua Private Site"
#define Host_name "Igua"


/* CHANGE THIS TO YOUR OWN UNIQUE VALUE.  The MAC number should be
 * different from any other devices on your network or you'll have
 * problems receiving packets. */
 byte mac[] = { 0x16, 0x16, 0x16, 0x16, 0x16, 0x01 };
	 
/* CHANGE THIS TO MATCH YOUR HOST NETWORK.  Most home networks are in
 * the 192.168.0.XXX or 192.168.1.XXX subrange.  Pick an address
 * that's not in use and isn't going to be automatically allocated by
 * DHCP from your router. */
 IPAddress ip(192,168,0,5);
 IPAddress gateway(192,168,0,5);
 IPAddress subnet(255, 255, 255, 0);
	 
/* This creates an instance of the webserver.  By specifying a prefix
* of "", all pages will be at the root of the server. */
#define PREFIX ""
WebServer webserver(PREFIX, 80);

boolean LED_status = 0;   // state of LED, off by default

// ROM-based messages used by the application
// These are needed to avoid having the strings use up our limited

// amount of RAM.

P(Page_start) = "<html><head><title>ManchiHouse</title></head><body>\n";
P(Page_end) = "</body></html>";
P(Get_head) = "<h1>GET from ";
P(Post_head) = "<h1>POST to ";
P(Unknown_head) = "<h1>UNKNOWN request for ";
P(Default_head) = "unidentified URL requested.</h1>
\n";
P(Line_break) = "
\n";
P(Form_Inicio) = "<form method=\"get\">";
P(Form_Final) = "</form>";

#define NAMELEN 32
#define VALUELEN 32


String GetParam(String ParamName, WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete)
	{
		URLPARAM_RESULT rc;
		char name[NAMELEN];
		char value[VALUELEN];
		String ReturnParam = "";

		if (strlen(url_tail))
		{
			while (strlen(url_tail))
			{
				rc = server.nextURLparam(&url_tail, name, NAMELEN, value, VALUELEN);
				if (rc != URLPARAM_EOS && String(name) == ParamName)				{
					ReturnParam = value;
				}
			}
		}
		if (type == WebServer::POST)		{
			while (server.readPOSTparam(name, NAMELEN, value, VALUELEN))			{

				if (String(name) == ParamName)				{
					ReturnParam = value;
				}
			}
		}

		return ReturnParam;
	}


	//Se mira la query para ver si se ha de activar o desactivar la linea
	String ProcesarCheckbox(String Estado)	{
		LED_status = 0;
		if (Estado == "1")
		{
			LED_status = true;
		}

	    if (LED_status) {    // switch LED on
	    	digitalWrite(2, HIGH);
	        // checkbox is checked
	        return "<input type=\"checkbox\" name=\"Luz\" value=\"1\" onclick=\"submit();\" checked>Apagar Luz";
	    }
	    else {              // switch LED off
	    	digitalWrite(2, LOW);
	        // checkbox is unchecked
	        return "<input type=\"checkbox\" name=\"Luz\" value=\"1\" onclick=\"submit();\">Encender Luz";
	    }
	}


void indexCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete)	{
	server.httpSuccess();
	if (type != WebServer::HEAD)		{
		P(Saludo) = "<h1>Bienvenido a IGUA!</h1><a href=\"control.html\">Acceder</a>";
		server.printP(Saludo);
	}
}

void controlCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete)	{
  /* if the user has requested this page using the following credentials
	   * username = user
	   * password = user
	   * display a page saying "Hello User"
	   *
	   * the credentials have to be concatenated with a colon like
	   * username:password
	   * and encoded using Base64 - this should be done outside of your Arduino
	   * to be easy on your resources
	   *
	   * in other words: "YWRtaW46YWRtaW4=" is the Base64 representation of "admin:admin"
	   *
	   * if you need to change the username/password dynamically please search
	   * the web for a Base64 library */
	   if (server.checkCredentials("YWRtaW46YWRtaW4="))	   {
	   	server.httpSuccess();
	   	String Estado = GetParam("Luz", server, type, url_tail, tail_complete);

	   	if (type != WebServer::HEAD)
	   	{
	   		P(Control_Head) = "<h1>Bienvenido al control de IGUA</h1><p>Indica si deseas encender o apagar la luz</p>";
	   		server.printP(Control_Head);
   		server.printP(Form_Inicio);
	   		server.println(ProcesarCheckbox(Estado));
	   		server.printP(Form_Final);
	   	}
	   }

	   else	   {
	   	Serial.println("No valido");
	   	/* send a 401 error back causing the web browser to prompt the user for credentials */
	   	server.httpUnauthorized();
	   }
	}

void failCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete)	{
	//this line sends the "HTTP 400 - Bad Request" headers back to the browser
	server.httpFail();

	/* if we're handling a GET or POST, we can output our data here.
	For a HEAD request, we just stop after outputting headers. */
	if (type== WebServer::HEAD)
	   	return;



  	server.printP(Page_start);

   	switch(type)	   {
	   	case WebServer::GET:	   	
	   							server.printP(Get_head);
	   							break;
	   	case WebServer::POST:   	
	   							server.printP(Post_head);
	   							break;
	   	default:
						   		server.printP(Unknown_head);
	   }

   	server.printP(Default_head);
   	server.print(url_tail);
   	server.printP(Page_end);
}

void setup() 	{

	Serial.begin(9600);
	Serial.println("Iniciado");
	/* initialize the Ethernet adapter */
  	//Ethernet.begin(mac, ip, gateway, subnet);

  	Serial.println("Trying to get an IP address using DHCP");
	if (Ethernet.begin(mac) == 0) {
		Serial.println("Failed to configure Ethernet using DHCP");
		// initialize the ethernet device not using DHCP:
		Ethernet.begin(mac, ip, gateway, subnet);
	}

	// print your local IP address:
  	Serial.print("My IP address: ");
	ip = Ethernet.localIP();
	for (byte thisByte = 0; thisByte < 4; thisByte++) {
	    // print the value of each byte of the IP address:
	    Serial.print(ip[thisByte], DEC);
	    Serial.print(".");
	}

	Serial.println();

	  /* setup our default command that will be run when the user accesses
	  * the root page on the server */
	  webserver.setDefaultCommand(&indexCmd);

	  /* setup our default command that will be run when the user accesses
	  * a page NOT on the server */
	  //webserver.setFailureCommand(&failCmd);

	  /* run the same command if you try to load /index.html, a common
	  * default page name */
	  webserver.addCommand("index.html", &indexCmd);
	  webserver.addCommand("control.html", &controlCmd);
	  /* start the webserver */
	  webserver.begin();
	  /*Indicamos que el PIN 2 será de salida
	  * para nosotros es donde estará el cable de Luz */
	  pinMode(2, OUTPUT);
	}



	void loop()	{

		char buff[64];
		int len = 64;

	/* process incoming connections one at a time forever */
	webserver.processConnection(buff, &len);

	}// WebDuino.ino

Resultado de la compilación con IDE 1.5.6

text data bss dec hex filename
22492 660 568 23720 5ca8 C:\Users\Ricardo\Documents\Arduino_Build\WebDuino/WebDuino.elf
Binary sketch size: 23152 bytes (of a 32256 byte maximum, 71.78 percent).
Estimated memory use: 1228 bytes (of a 2048 byte maximum, 59.96 percent).
[Stino - Done compiling.]

Es gracioso, ahora al copilar con la version 1.6.4 se me queda estatico en la compilacion, descargare la version que utilizaste para ver, muchisimas gracias :slight_smile:

Edit: He descargado la version 1.5.6-r2 y no he podido compilar me da el mismo error.