 }
 
 
-
-
-	void Invia_Pagina_Web() {
-	  // Usando le funzioni WiServer.print trasmette al pagina Web da visualizzare
-	  WiServer.print ("<html>");
-	  WiServer.print ("<head>");
-WiServer.print ("<meta http-equiv=""content-type"" content=""text/html; charset=utf-8"" />");
-//WiServer.print ("<meta http-equiv=""refresh"" content=""25;url=http://192.168.1.60"" />");
-WiServer.print ("<title>OneButtonAlert Device</title>");
-//WiServer.print ("<link rel=""stylesheet"" type=""text/css"" media=""One Button Alert"" href=""http://onebuttonalert.com/buttonpressed/demo.css"" />");
-
-	 
-
-	  WiServer.print ("</head>");
-	  WiServer.print ("<body><p align=""center"">");
+void _webpageHelper() 
+{
+	WiServer.print ("<html>");
+	WiServer.print ("<head>");
+    WiServer.print ("<meta http-equiv=""content-type"" content=""text/html; charset=utf-8"" />");
+    //WiServer.print ("<meta http-equiv=""refresh"" content=""25;url=http://192.168.1.60"" />");
+    WiServer.print ("<title>OneButtonAlert Device</title>");
+    //WiServer.print ("<link rel=""stylesheet"" type=""text/css"" media=""One Button Alert"" href=""http://onebuttonalert.com/buttonpressed/demo.css"" />");
+ 
+	WiServer.print ("</head>");
+    WiServer.print ("<body><p align=""center"">");
 
 
 
-	 // WiServer.print ("<div align=""center""><img src=""http://www.onebuttonalert.com/logo.png"" border=""0""></div>");
-	  WiServer.print ("<br>");
-	  WiServer.print ("<br>");
-	  WiServer.print ("<b><font size=20><center>Device Local IP Address Status</center></b><br>");
-	  WiServer.print ("<center>");
+	// WiServer.print ("<div align=""center""><img src=""http://www.onebuttonalert.com/logo.png"" border=""0""></div>");
+	WiServer.print ("<br>");
+	WiServer.print ("<br>");
+    WiServer.print ("<b><font size=20><center>Device Local IP Address Status</center></b><br>");
+    WiServer.print ("<center>");
 
-          WiServer.print (local_ip[0], DEC);
-	  WiServer.print (".");
-	  WiServer.print (local_ip[1], DEC);
-	  WiServer.print (".");
-	  WiServer.print (local_ip[2], DEC);
-	  WiServer.print (".");
-	  WiServer.print (local_ip[3], DEC);
+    WiServer.print (local_ip[0], DEC);
+	WiServer.print (".");
+    WiServer.print (local_ip[1], DEC);
+	WiServer.print (".");
+    WiServer.print (local_ip[2], DEC);
+	WiServer.print (".");
+    WiServer.print (local_ip[3], DEC);
 
-          WiServer.print ("</center></font><br>");
+    WiServer.print ("</center></font><br>");
      
-	  if (thestart == 0) {
-	   WiServer.print ("<div align=""center""><form><font size=20 color=red>Engine Motor - ON</font><br>");
-	   WiServer.print ("<method=GET>");
-           WiServer.print ("<select name=""OPERATION"" id=""OPERATION"" style=""font-size:50px""><option value=""OFF"">Turn ON</option><option value=""ON"">Turn OFF</option><option value=""90"">90</option></select>");
-	   WiServer.print ("<h1><input type=submit value=SUBMIT style=""font-size:50px""></h1></form></div><br>");
-	 }    
-	  else {
-	   WiServer.print ("<div align=""center""><form><font size=20 color=green> Engine Motor - OFF</font><br>");
-	   WiServer.print ("<method=GET>");
-           WiServer.print ("<select name=""OPERATION"" id=""OPERATION"" style=""font-size:50px""><option value=""OFF"">Turn ON</option><option value=""ON"">Turn OFF</option><option value=""90"">90</option></select>");
-          // WiServer.print ("<select name=""OPERATION"" id=""OPERATION"" style=""font-size:50px""><option value=""OFF"">Turn OFF</option><option value=""90"">POWER UP</option></select>");
-	   WiServer.print ("<input type=submit value=SUBMIT ></form></div><br>");
-	 }   
+    if (thestart == 0) {
+	    WiServer.print ("<div align=""center""><form><font size=20 color=red>Engine Motor - ON</font><br>");
+	    WiServer.print ("<method=GET>");
+        WiServer.print ("<select name=""OPERATION"" id=""OPERATION"" style=""font-size:50px""><option value=""OFF"">Turn ON</option><option value=""ON"">Turn OFF</option><option value=""90"">90</option></select>");
+	    WiServer.print ("<h1><input type=submit value=SUBMIT style=""font-size:50px""></h1></form></div><br>");
+	}    
+    else {
+	    WiServer.print ("<div align=""center""><form><font size=20 color=green> Engine Motor - OFF</font><br>");
+	    WiServer.print ("<method=GET>");
+        WiServer.print ("<select name=""OPERATION"" id=""OPERATION"" style=""font-size:50px""><option value=""OFF"">Turn ON</option><option value=""ON"">Turn OFF</option><option value=""90"">90</option></select>");
+        // WiServer.print ("<select name=""OPERATION"" id=""OPERATION"" style=""font-size:50px""><option value=""OFF"">Turn OFF</option><option value=""90"">POWER UP</option></select>");
+	    WiServer.print ("<input type=submit value=SUBMIT ></form></div><br>");
+	}   
 	 
 
-	  WiServer.print ("</div></body></html>");
-	}
+	WiServer.print ("</div></body></html>");
+}
 	 
 
 
-	void move_to_start() {
- 
-         myMotor.write(80);
-         
-
-
-//delay(500); // delay 1000ms, this allows the previous instruction to be finished. 
-
-	}
+void move_to_start() 
+{
+    myMotor.write(80);
+    //delay(500); // delay 1000ms, this allows the previous instruction to be finished. 
+}
 	 
 
-	void move_to_end() {
+void move_to_end() 
+{
+    myMotor.write(70);
+}
 
-         myMotor.write(70);
-         
-       
-	}
-
-	void move_to_ninty() {
-
-         myMotor.write(90);
-         
-
-	}
+void move_to_ninty()
+{
+    myMotor.write(90);
+}

  WiServer.enableVerboseMode(false);
}





void loop()
{
  // Run WiServer

unsigned char security_passphrase_len;
// End of wireless configuration parameters ----------------------------------------

// This is our page serving function that generates web pages
boolean sendMyPage(char* URL) 
{
         
    // Check if the requested URL matches "/"
    if (strcmp(URL, "/") == 0) {
        _webpageHelper();
        // URL was recognized
        return true;
    }
  
    if (strcmp (URL, "/?OPERATION=OFF") == 0) {
        thestart = 1;
        _webpageHelper();
	    move_to_start();       
	    return (true);
    }    
	 
	
	if (strcmp (URL, "/?OPERATION=ON") == 0) {
        thestart = 0;
        _webpageHelper();
	    move_to_end();
	    return (true);
    }    
    
 
    if (strcmp (URL, "/?OPERATION=90") == 0) {
	    thestart = 0;
	    _webpageHelper(); 
        move_to_ninty();
	    return (true);
	}    

    // URL not found
    return false;
}

int i = 0;     // Loop counter 
    
// This is our motor.
Servo myMotor;

void arm(){
    // arm the speed controller, modify as necessary for your ESC  
    setSpeed(0); 
    delay(3000); //delay 1 second,  some speed controllers may need longer
}

void setSpeed(int speed){
      // speed is from 0 to 100 where 0 is off and 100 is maximum speed
      //the following maps speed values of 0-100 to angles from 0-180,
     // some speed controllers may need different values, see the ESC instructions
     int angle = map(speed, 0, 100, 0, 180);
     myMotor.write(angle);    
}

void setup() {
 
