question about malfunctioning code

const int wing1 = 2;
const int wing2 = 3;
const int tail = 4;
unsigned long prevTime = 0;
int fase1 = prevTime;
int fase2 = prevTime + 100;
int fase3 = prevTime + 2000;
int fase4 = prevTime + 2100;
int fase5 = prevTime + 4000;
void setup() {
pinMode(wing1,OUTPUT);
pinMode(wing2,OUTPUT);
pinMode(tail,OUTPUT);
}

void loop() {
unsigned long timePast = millis();
if(timePast == fase1){
digitalWrite(wing1,HIGH);
digitalWrite(wing2,HIGH);
digitalWrite(tail,LOW);
}
else if(timePast == fase2){
digitalWrite(wing1,LOW);
digitalWrite(wing2,LOW);
}
else if(timePast == fase3){
digitalWrite(tail,HIGH);
}
else if(timePast == fase4){
digitalWrite(tail,LOW);
}
else if(timePast == fase5){
prevTime = timePast;
}
}

it doesnt reset the time so it goes through the program once and then it stops, the led's stop blinking. please help.

Maybe you never hit those times exactly.

Please remember to use code tags when posting code

We don't know what this is supposed to do.

int fase1 = prevTime;
int fase2 = prevTime + 100;
int fase3 = prevTime + 2000;
int fase4 = prevTime + 2100;
int fase5 = prevTime + 4000;

The above should be 'type' 'unsigned long'.

Are you sure == is going to catch the event?

if(timePast == fase1){

As AWOL points out, the chances of you hitting the exact time count is pretty close to zero. Instead, do some kind of inequality check:

if(timePast > fase1){

...but the unsigned long thing is good too
( ">=" better than "==" or ">")

int fase1 = prevTime;
int fase2 = prevTime + 100;
int fase3 = prevTime + 2000;
int fase4 = prevTime + 2100;
int fase5 = prevTime + 4000;

As previously recommend, change to unsigned long and use the >= comparison in loop()

The fase variables do not change based on their declaration. The must be explicitly modified.

else if(timePast == fase5){
 prevTime = timePast;
 fase1 = prevTime;
 fase2 = prevTime + 100;
 fase3 = prevTime + 2000;
 fase4 = prevTime + 2100;
 fase5 = prevTime + 4000;
}

Thanks for all your reply's, it turned out to be the fact that the variables were not declared in loop and they were not unsigned long. Thanks for the advice.

It will fail when millis() rolls over because there is no subtraction from millis().

, it turned out to be the fact that the variables were not declared in loop

Nope