I am receiving error with unusual characters using Adafruit Wifi shield

I am receiving continuous characters like this:

Ì?¡×Ht"aªñ9æn¹á?ïz)º¬Ò?

The code I uploaded:

/*
WirelessControllerWifi is one of the applicatioin of CC3000 Wifi Module
                  - This sample application code simply turns on and off
                   an LED remotely via Wifi.
                  - It is suggested to use Atmega644 to avoid further
                    RAM issues.
                  - The IP address given to CC3000 by the Access Point
                    is static. Therefore, it is advisable to make sure
                    that the IP address entered to the browser is correct.
                   
Execution:
  1. Once uploaded to the microcontroller, open the serial.
  2. Wait for successful connection.
  3. When DHCP request is successful, Copy the IPaddress given to your device.
  4. Enter the IPaddress to your browser.
  5. The small Wireless Controller webpage will then be loaded.
  6. Click ON button to turn on the LED and OFF button to turn it off.

Wiring Connection:
  1. Connect +pin of LED(series with current limiting resistor if needed) to pin 14(A0).
             -pin to GND. This will be the LED to be controlled.
  2. Connect +pin of LED(series with current limiting resistor if needed) to pin 9.
             -pin to GND. This will be the wifi connection indicator.           
             
Notes:
  Reserved pins for CC3000 and SD Card communication are as follows.
    CC3000 Breakout Board              Gizduino
          SCK   <------------------> Digital pin 13
          MISO  <------------------> Digital pin 12
          MOSI  <------------------> Digital pin 11
          CS    <------------------> Digital pin 10
          V_EN  <------------------> Digital pin 5
          uSDCS <------------------> Digital pin 4
          IRQ   <------------------> Digital pin 3
References:
         - Adafruit_CC3000 ChatServer.ino
         - Ethernet WebServer.ino
         - Important Libraries from Adafruit: https : // learn . adafruit . com /adafruit-cc3000-wifi / cc3000-library-software

Created On:  28 APR 14
        By:  e-Gizmo Mechatronix Central
*/

#include <Adafruit_CC3000.h>
#include <SPI.h>
#include "utility/debug.h"
#include "utility/socket.h"

/* --- CC3000 constants --- */
// These are the interrupt and control pins
#define ADAFRUIT_CC3000_IRQ   3  // MUST be an interrupt pin!
// These can be any two pins
#define ADAFRUIT_CC3000_VBAT  5
#define ADAFRUIT_CC3000_CS    10
// Use hardware SPI for the remaining pins
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
                                         SPI_CLOCK_DIVIDER); // you can change this clock speed
#define WLAN_SSID       "Arizona"        // cannot be longer than 32 characters!
#define WLAN_PASS       "08d6d345c2a4"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY   WLAN_SEC_WPA2
#define LISTEN_PORT           80 
Adafruit_CC3000_Server gizduinoServer(LISTEN_PORT);  //(LISTEN_PORT);

/* --- Webpage variables --- */
String req;     // Will handle the request of the client.
String reqsub;  // Request substring to for keyword "on" or "of".
char webpage[] = "<!DOCTYPE HTML><html><body bgcolor=\"#00529b\"><center><font color = \"white\"><h1>Wireless Controller via Wi-Fi</h1><h2>by Nexys</h2></font>
<form method=\"get\"><input type=\"button\"style=\"height:100px;width:100px\" value=\"ON LED 1\"onclick=\"window.location='/?on'\">&nbsp;<input type=\"button\"style=\"height:100px;width:100px\"value=\"OFF LED 1\"onclick=\"window.location='/?of'\">
<input type=\"button\"style=\"height:100px;width:100px\" value=\"ON LED 2\"onclick=\"window.location='/?no'\">&nbsp;<input type=\"button\"style=\"height:100px;width:100px\"value=\"OFF LED 2\"onclick=\"window.location='/?fo'\"></form></center></body></html>";

/* --- LED Indicators --- */
#define controlLED 31
#define controlLED1 30
#define wifiLED 9

void setup(void)
{
  Serial.begin(9600);
  Serial.print("Free RAM: "); Serial.println(getFreeRam(), DEC); 
  /* Initialise the module */
  Serial.println("Initializing...");
  if (!cc3000.begin())
  {
    Serial.println("Couldn't begin()! Check your wiring?");
    while(1);
  } 
  Serial.print("Attempting to connect to "); Serial.println(WLAN_SSID);
  if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
    Serial.println("Failed!");
    while(1);
  }  
  Serial.println("Connected!");  
  Serial.println("Request DHCP...");
  cc3000.checkDHCP();
  // Display the IP address DNS, Gateway, etc.
  while (! displayConnectionDetails()) {  
    delay(1000);
  }  
  gizduinoServer.begin();  // Start listening for connections
  Serial.println("Waiting for Client...");
  
  pinMode(wifiLED,OUTPUT);  // LED pin for Wifi connection indicator.
  digitalWrite(wifiLED,HIGH);
  pinMode(controlLED,OUTPUT);  // LED pin to be controlled.
  pinMode(controlLED1,OUTPUT);  // LED pin to be controlled.
  
}

void loop(void){
  
  if(!cc3000.checkConnected()){
    Serial.println("CONNECTION LOST!");
    digitalWrite(wifiLED,LOW);
    while(1);
  }else{  
    // Try to get a client which is connected.
    Adafruit_CC3000_ClientRef client = gizduinoServer.available();
    if (client) {
      Serial.println("New client");
      // an http request ends with a blank line
      boolean currentLineIsBlank = true;
      while (client.connected()) {
        if (client.available()) {
          char c = client.read();
          Serial.write(c);
          req += c;
          reqsub = req.substring(6,8);
          if (reqsub == "of"){
            digitalWrite(controlLED, LOW);
          }
          if (reqsub == "on"){
            digitalWrite(controlLED, HIGH);
          }
          if (reqsub == "fo"){
            digitalWrite(controlLED1, LOW);
          }
          if (reqsub == "no"){
            digitalWrite(controlLED1, HIGH);
          }
          // Send a reply to the client
          if (c == '\n' && currentLineIsBlank) {
            // send a standard http response header
            client.println("HTTP/1.1 200 OK");
            client.println("Content-Type: text/html");
            client.println("Connection: close");  // the connection will be closed after completion of the response
            client.println();
            // Give the web page to the client
            client.println(webpage);
            client.println("");       
            break;
          }
          if (c == '\n') {
            // you're starting a new line
            currentLineIsBlank = true;
          } 
          else if (c != '\r') {
            // you've gotten a character on the current line
            currentLineIsBlank = false;
          }
        }
      }    
      // give the web browser time to receive the data
      delay(100);
      // close the connection
      client.close();
      Serial.println("Client disconnected");
      req="";
    }    
  }
}

/**************************************************************************/
/*!
    @brief  Tries to read the IP address and other connection details
*/
/**************************************************************************/
bool displayConnectionDetails(void)
{
  uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
  
  if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv))
  {
    Serial.println(F("Unable to retrieve the IP Address!\r\n"));
    return false;
  }
  else
  {
    Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
    Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
    Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
    Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
    Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
    Serial.println();
    return true;
  }
}

I am connected with a USB
and a 12v power supply.

I wan to know why this is happening when I connect the 12v power supply, and when I only connect the USB cable, the error doesn't show.

I really want it to use with 12v power supply alone without the usb cable because it is brighter with it.

Please help. Thank you.

If you are using an Uno, I will take a guess that you are overflowing your SRAM. You should limit the number of characters you are storing in the req variable.

         req += c;

SurferTim:
If you are using an Uno, I will take a guess that you are overflowing your SRAM. You should limit the number of characters you are storing in the req variable.

         req += c;

Do you think this causes the error?

char webpage[] = "<body bgcolor="#00529b"><font color = "white">

Wireless Controller via Wi-Fi

by Nexys

   ";

Both in combination would certainly cause that error. You should keep the "webpage" variable in program memory, and also limit the number of characters stored by the "req" variable.

SurferTim:
Both in combination would certainly cause that error. You should keep the "webpage" variable in program memory, and also limit the number of characters stored by the "req" variable.

I'm new to Arduino programming, how can I limit the characters in the "req" var. ?

Something like this. This limits the req variable length to 64 characters. 63 printable and one zero terminator.

if(req.length() < 63) req += c;

edit: Oops! My bad. The comparator value was one too big. Should be 63, not 64.

It doesn't work, it .

Here's the Serial Monitor output when i click the On Button from the webpage.

Free RAM: 2067
Initializing...
Attempting to connect to Arizona
Connected!
Request DHCP...
Unable to retrieve the IP Address!


IP Addr: 192.168.43.246
Netmask: 255.255.255.0
Gateway: 192.168.43.1
DHCPsrv: 192.168.43.1
DNSserv: 192.168.43.1
Waiting for Client...
New client
GET / HTTP/1.1
Host: 192.168.43.246
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
x-wap-profile: http://218.249.47.94/Xianghe/MTK_Phone_JB_UAprofile.xml
X-Requested-With: com.nexys.anemhobrowser
User-Agent: Mozilla/5.0 (Linux; U; Android 4.2.2; en-us; CD-R KING Arizona Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
Accept-Encoding: gzip,deflate
Accept-Language: en-US
Accept-Charset: utf-8, utf-16, *;q=0.7

Client disconnected
New client
GE?/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?{b!¬¯/ôãaô?>Û+æu?ÿZáÕ )zN6e???ZA*Ç
¼~ÿ½ùQ/¢k°Ùï%EGóB ?û   "---And so on .. . ."

It doesn't work, it .

I changed my code. I'm not going to show you the changed code. But, I still want to know what is wrong with it.

Did I paraphrase your post correctly?

PaulS:

It doesn't work, it .

I changed my code. I'm not going to show you the changed code. But, I still want to know what is wrong with it.

Did I paraphrase your post correctly?

Exactly.

I think the original code works fine. But when I put the 12 volts power supply the webpage doesn't reload and the light doesn't turn off unless I restart it.

When I only use the USB cable as a supply and monitor the code works, but my problem is I wan't it to be on a power supply with a 9 or 12 volts alone to make the LED brighter.

Did you use the PROGMEM attribute to keep your webpage variable in program memory? I haven't tested the SRAM use if you use PROGMEM to see if it loads the variable into SRAM before accessing it. The F() function appears to load the variable into SRAM, but unlike a "regular" variable without the F() function, doesn't keep it there. It releases that SRAM immediately after it is used in your code.

I think the original code works fine.

Does it? This does not sound like a power supply problem. It is failing at exactly the same point every time, isn't it? That sounds like a memory overflow.

Without the USB cable, and the serial output, how do you know that the output changes?

PaulS:
Without the USB cable, and the serial output, how do you know that the output changes?

Without it, if the system works fine, the webpage reloads, but if not - the webpage doesn't reload and when I press the buttons, it doesn't respond. This happens when i put the power supply but not when only the usb cable.

I didn't notice this:

I really want it to use with 12v power supply alone without the usb cable because it is brighter with it.

What is brighter? The USB cable should provide 5 volts. The barrel connector input voltage should be regulated to 5 volts. Nothing should be brighter either way.