Erro na programação

Boa noite,

Eu estou já várias semanas a tentar resolver um problema e não consigo.

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

byte mac[] = { 
  0x90, 0xA2, 0xDA, 0x00, 0x9B, 0x36 }; //physical mac address
byte ip[] = { 
  172, 16, 0, 10 }; // ip in lan
byte gateway[] = { 
  172, 16, 0, 1 }; // internet access via router
byte subnet[] = { 
  255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port

String readString;

int pin = 9;
boolean ligado = true;

//////////////////////

void setup(){

  pinMode(pin, OUTPUT); //pin selected to control
  //start Ethernet
  Ethernet.begin(mac, ip, gateway, subnet);
  server.begin();
  //the pin for the servo co
  //enable serial data print
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
  Serial.println("Automação Residencial - EPB"); // so I can keep track of what is loaded

}

void SendOKpage(EthernetClient &client)
{
  // send a standard http response header
  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>Remote Automation</title>");
  client.println("<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>");
  client.println("</head>");
  client.println("<body>");
  client.println("<div id='wrapper'>Remote Automation V1.1");
  client.print("<div id='rele'></div><div id='estado' style='visibility: hidden;'>");
  client.print(ligado);
  client.println("</div>");
  client.println("<div id='botao'></div>");
  client.println("</div>");
  client.println("<script>AlteraEstadoRele()</script>");
  client.println("</body>");
  client.println("</head>");     
  client.println("</html>");
}


void SendAuthentificationpage(EthernetClient &client)
{
  client.println("HTTP/1.1 401 Authorization Required");
  client.println("WWW-Authenticate: Basic realm=\"Secure Area\"");
  client.println("Content-Type: text/html");
  client.println("Connnection: close");
  client.println();
  client.println("<!DOCTYPE HTML>");
  client.println("<HTML>  <HEAD>   <TITLE>Error</TITLE>");
  client.println(" </HEAD> <BODY><H1>401 Unauthorized.</H1></BODY> </HTML>");
}

char linebuf[80];
int charcount=0;
boolean authentificated=false;

void loop() {
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
    Serial.println("new client");
    memset(linebuf,0,sizeof(linebuf));
    charcount=0;
    authentificated=false;
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        linebuf[charcount]=c;
        if (charcount<sizeof(linebuf)-1) charcount++;
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          if (authentificated)
            SendOKpage(client);
          else
            SendAuthentificationpage(client); 
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
          if (strstr(linebuf,"Authorization: Basic")>0 && strstr(linebuf,"ZXBiOmVwYjIwMTU=")>0)
            authentificated=true;
          memset(linebuf,0,sizeof(linebuf));
          charcount=0;
        }
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    Serial.println(readString); //print to serial monitor for debuging
    if(readString.indexOf("?ligar") >0)//checks for on
    {
      digitalWrite(pin, HIGH);    // set pin 4 high
      Serial.println("On");
      ligado = false;
    }
    else{
      if(readString.indexOf("?desligar") >0)//checks for off
      {
        digitalWrite(pin, LOW);    // set pin 4 low
        Serial.println("Off");
        ligado = true;
      }
    }
    //clearing string for next read
    readString="";

    // close the connection:
    client.stop();
    Serial.println("client disonnected");
  }
}

no código eu pretendo inserir senha e depois de efetuar login ligar e desligar 1 led ou seja enviar comando, no entanto com esse código faço login, só que ao dar o comando ele não é executado…

Alguém pode ajudar por favor?

Obrigado

1º readString() é uma função do Arduino: Stream.readString() - Arduino Reference

Usa outro nome para a tua variável para não haver confusões.

2º readString nunca toma nenhum valor no teu código logo nunca vais conseguir comparar nada.