Shared tasks

I’m working with arduino one. The robot uses two motors, two encoders, a servo, a color sensor, a button and an 8x2 lcd. Sending serial data to lcd is done by pin 13, I want the animation to work in an infinite loop while the button is not pressed. With my code, the sequence of the animation “rutina_principal()” is performed once, in the correct sequence and respecting the times, but then, it shows the characters randomly and without respecting the times.

This function is the one that gives me problems:

void rutina_principal(){


if(millis() - time1 == timeFuncion1){
ojos_Cerrados_centroSuperior();
time1 = millis();
}

if(millis() - time2 == timeFuncion2){
ojos_grandesAbiertos_centroSuperior();
time2 = millis();
}

if(millis() - time3 == timeFuncion3){
ojos_Cerrados_centroSuperior();
time3 = millis();
}
if (millis() - time4 == timeFuncion4){  
ojos_grandesAbiertos_centroSuperior();
time4 = millis();

}

if (millis() - time5 == timeFuncion5){  
ojos_Tristes_centroSuperior();
time5 = millis();

}

if(millis() - time6 == timeFuncion6){  
ojos_Aburridos_miraDerecha_superior();
time6 = millis();

}

if(millis() - time7 == timeFuncion7){  
ojos_Aburridos_miraIzquierda_superior();
time7 = millis();

}

if(millis() - time8 == timeFuncion8){
ojos_Cerrados_centroSuperior();
time8 = millis();

}}

I attach my complete code

Please help me with this
Greetings

sketch_dec07a.ino (27.6 KB)

Brief look to code and I think the '==' would be '>='. It is hard to hit the right millisecond, isn't it?

You might think that millis() counts 1, 2, 3, ... but in reality it skips a count once in a while. I agree that '==' should be '>=' where millis() is involved.

I already tried it but with the comparison operator "> =" the code is played randomly

Budvar10:
Brief look to code and I think the '==' would be '>='. It is hard to hit the right millisecond, isn't it?

vaj4088:
You might think that millis() counts 1, 2, 3, ... but in reality it skips a count once in a while. I agree that '==' should be '>=' where millis() is involved.

With the comparison operator "> =", the sequence executes well the first time, then it does it randomly,I would like the sequence to be executed correctly in an infinite loop

Put EVERY { on a line by itself.
Use Tools + Auto Format.

Your code is just about impossible to read.