I'm not really surprised it's not working. Lets break down your snippet.
// Say Contador is set to zero (0) and readString == "ON1" and SetRoutine == 0.
if (readString == "ON1")
{
if (SetRoutine ==0)
{
Contador++; // Contador (0) + 1 = 1.
digitalWrite(LED1, HIGH);
Memoria[Contador] = 10; Memoria[ 1 ] = 10;
}Now say readString == "ON1" again and SetRoutine == 1
if (SetRoutine == 1)
{
Contador++; (1) + 1 = 2
digitalWrite(LED1, HIGH);
Comparador[Contador] = 10; // Comparador[ 2 ] = 10;
if(Memoria[1] == Comparador[1]) // Memoria[ 1 ] = 10 and Comparador[ 1 ] = NULL
{
a = 5;
}
}
}
These two will never be equal unless you reset Contador back to zero or have your code like this "if(Memoria[1] == Comparador[2])" instead.