 int nextCounter = 0;
 
 char respuesta50[3];
-char respuesta51[9];
+char respuesta51[10];
+
+char rojo[2];
+char blanco[2];
+char amar[2];
+char plata[2];
+char azul[2];
+
+bool a;
 
 void setup() {
   pinMode(botonRojo,INPUT);

      }
    }
    else if (resp==51) {
      while(nextCounter<5) {
        //interaccion 7 pulsadores
        if (digitalRead(botonRojo) == LOW) {
          rojoCounter += 1;
          delay(500);
        }
        else if (digitalRead(botonBlanco) == LOW) {
          blancoCounter += 1;
          delay(500);
        }
        else if (digitalRead(botonAmarillo) == LOW) {
          amarilloCounter += 1;
          delay(500);
        }
        else if (digitalRead(botonPlata) == LOW) {
          plataCounter += 1;
          delay(500);
        }
        else if (digitalRead(botonAzul) == LOW) {
          azulCounter += 1;
          delay(500);
        }
        else if (digitalRead(botonNext) == LOW) {
          nextCounter += 1;
          delay(500);
        }
        else if (digitalRead(botonReset) == LOW) {
          rojoCounter = 0;
          blancoCounter = 0;
          plataCounter = 0;
          amarilloCounter = 0;
          azulCounter = 0;
          nextCounter = 0;
          delay(500);
        }
      }
      if (nextCounter == 5) {
        sprintf(respuesta51, "%d|%d|%d|%d|%d", rojoCounter, azulCounter, amarilloCounter, blancoCounter, plataCounter);
        rojoCounter = 0;
        blancoCounter = 0;
        plataCounter = 0;
        amarilloCounter = 0;
        azulCounter = 0;
        nextCounter = 0;
        Serial.write(respuesta51);
      }
    }
  }

      analogWrite(electroiman_PWM,0);
    }
    else if (resp==50) {
      a = true;
      rojoCounter = 0;
      blancoCounter = 0;
      while(a) {
        //interaccion 4 pulsadores
        if (digitalRead(botonRojo) == LOW) {
          rojoCounter += 1;
          delay(300);
        }
        else if (digitalRead(botonBlanco) == LOW) {
          blancoCounter += 1;
          delay(300);
        }
        else if (digitalRead(botonNext) == LOW) {
          a = false;
          sprintf(respuesta50, "%d|%d", rojoCounter, blancoCounter);
          Serial.write(respuesta50);
          delay(300);
        }
        else if (digitalRead(botonReset) == LOW) {
          rojoCounter = 0;
          blancoCounter = 0;
          delay(300);
        }
      }
      if (nextCounter == 2) {
