Comandos via serial interrompendo comandos por html

I have a simple control project of lamps per html and serial port.
when I open the browser and turned on or off the relay works perfectly
When I use the serial monitor to turn the relay on and off, it works, but after that the arduino does not obey the browser commands anymore (html).
the code is attached

I.A_Jarvis_1.0.ino (7.7 KB)

@Tropecoandre, do not hijack. Do not cross-post. Other post removed.

void loop()
  if (Serial.available())
    PortaSerial =;

  //-----------------------------------Controle via porta serial--------------------------------
  if (PortaSerial == 65)  //Letra "A" liga
    digitalWrite(LampadaSala, HIGH);

The way you have written this, if you receive an 'A' the "if (PortaSerial == 65)" will execute over and over. All of the 'if' statements that figure out what to do with input characters should be INSIDE the "if (Serial.available())".