Control led brightness via web server using ethernet shield

I'm working on a 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 :slight_smile:

LEDbrightness.ino (2.85 KB)

				client.println("HTTP/1.1 200 OK");//send new page    
				client.println("Content-Type: text/html");            
				client.println(); 
				client.println("<HTML>");     
				client.println("<HEAD>");     
				client.println("<TITLE>Arduuino Project</TITLE>"); 
		                client.println("<meta http-equiv=\"refresh\" content=\"1\">");

				client.println("</HEAD>");  
				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>");

Several problems here. First, you misspelled Arduino. Second, a one second refresh rate is far too often. Third, none of the long string literals are wrapped in the F() macro.

client.println(F("HTTP/1.1 200 OK"));//send new page
Keep all of that crap out of your precious SRAM.

                                        if(readString.indexOf("?light-") >0)//checks for -   
More waste of SRAM. The String class is horridly inefficient.

					{   brightness = brightness-15;

Have you ever considered why the language we use is called C++, rather than C=C+1? There's a good reason.

Quit looking like a FORTRAN programmer forced to use C.

					{
                                            brightness -= 15;
}}}}

Horsecrap! ONE } per line is the maximum.

Nothing that the Arduino does can crash your browser. You may be running out of memory on the Arduino, causing it to crash, resulting in it not serving up a page one second later, when asked again, but the browser didn't crash.