Control led brightness via web server using arduino uno + ethernet shield

I’m working on a little project where I want to control a LED brithness via my browser using arduino uno + ethernet shield . well, might as well i try to do it , but something went wrong (it’s work just in the first click then the browser page crashes in the next ).
can some one help me plz !!!
i will attach the file that i do

LEDbrightness.ino (2.85 KB)

7 below shows how to post code if you want people to look at it. That being said, it is fairly easy to add buttons or text boxes to web pages to send control data back to the arduino.,148850.0.html

this is the code

 #include <SPI.h>
 #include <Ethernet.h>  
 #include <Servo.h>  
 Servo myservo;  // create servo object to control a servo   
 byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address   
 byte ip[] = { 192 , 168, 1, 177 }; // fixed IP addr  in LAN   
 byte gateway[] = { 192 , 168 , 1 , 1 }; // internet access via router   
 byte subnet[] = { 255, 255, 255, 0 }; //subnet mask   
 EthernetServer server(80); //server port       
 String readString;  
 void setup(){ 
 pinMode(9, OUTPUT); //pin selected to control LED  4
 //start Ethernet   
 Ethernet.begin(mac, ip, gateway, subnet); 
 server.begin();       //the pin for the servo co     
 //enable serial data print  
 void loop(){   
   byte brightness;
   delay(1000);                           //wait one second before sending new data

 // Create a client connection      
 EthernetClient client = server.available();   
 if (client) {      
	while (client.connected()) {   
		if (client.available()) {   
			char c =;                  //read char by char HTTP request  
			if (readString.length() < 100) {   //store characters to string     
				readString += c;        //Serial.print(c);             }          
				//if HTTP request has ended      
				if (c == '\n') {        
				Serial.println(readString); //print to serial monitor for debuging      
				client.println("HTTP/1.1 200 OK");//send new page    
				client.println("Content-Type: text/html");            
				client.println("<TITLE>Arduuino Project</TITLE>"); 
		                client.println("<meta http-equiv=\"refresh\" content=\"1\">");

				client.println("<BODY bgcolor='black'><center>");   
				client.println("<H1 style=\"background-color:white;\">Arduino project</H1>");    
                                client.println("<a href=\"/?light-\"> - </a> <a href=\"/?light+\"> + </a>");
                                client.println(" </center></BODY></HTML>");
				//stopping client      
                                        if(readString.indexOf("?light-") >0)//checks for -    
					{   brightness = brightness-15;
                                            analogWrite(9, brightness);   
						Serial.println("brightness -");            
						if(readString.indexOf("?light+") >0)//checks for +   
					{   brightness = brightness+15;
                                            analogWrite(9, brightness);   
						Serial.println("brightness +"); 

				readString="";   //clearing string for next read     


Below is the web page that you have generated. All it does is refresh the page and does not send your intended control commands. Bottom is what the serial monitor is printing out. You probably need to drop the meta refresh and make buttons to send your commands.

edit: after cleaning up your html so I could see the buttons, it appears your basic incremental dim/brighten code is flawed. You need to fix that issue using the serial monitor, then move to put it in a web page. bottom is the serial monitor output.

<TITLE>Arduuino Project</TITLE>
<meta http-equiv="refresh" content="1">
<BODY bgcolor='black'><center>
<H1 style="background-color:white;">Arduino project</H1>
<a href="/?light-"> - </a> <a href="/?light+"> + </a>
GET / HTTP/1.1

GET / HTTP/1.1

GET / HTTP/1.1

GET / HTTP/1.1

GET / HTTP/1.1

GET / HTTP/1.1

GET / HTTP/1.1
GET / HTTP/1.1

GET /?light- HTTP/1.1

brightness -
GET /?light- HTTP/1.1
GET /?light+ HTTP/1.1

brightness -
GET /?light- HTTP/1.1
GET /?light+ HTTP/1.1
GET /?light- HTTP/1.1

brightness -
GET /?light- HTTP/1.1
GET /?light+ HTTP/1.1
GET /?light- HTTP/1.1
GET /?light+ HTTP/1.1

brightness -