Problem with my serial monitor

  if ( digitalRead(0) == HIGH ) 
  {
      // flanco descendente
      if ( digitalRead(0) == LOW )
      {

Pin 0 is one half of the Serial pins. You can't use pin 0 or 1 for a switch, too.