This makes sense?

for(int i= 0; i<=100;i++)
      {
       Lec_Ultra = analogRead(Ultrasonido);
       delay(50);
       map(Lec_Ultra,0,1023,0,255);
       delay(20);
       
          if(Lec_Ultra >= 280)
           {
             digitalWrite(ElecValv_Traslacion_Afuera,RELAY_ON);
             Cont_Ultra++;
           }
           if(Lec_Ultra <= 400)
           {
             digitalWrite(ElecValv_Traslacion_Afuera,RELAY_OFF);
           }
           Serial.println(Cont_Ultra);
      }



for(int j=0;j==Cont_Ultra;j++)
      {
         delay(70);
         digitalWrite(ElecValv_Traslacion_Afuera,RELAY_ON);
         
      }
        digitalWrite(ElecValv_Traslacion_Afuera,RELAY_OFF);

My question is...j == Cont_Ultra , it can be possible? i mean...my second "for loop" can repeat same number of times that Cont_Ultra counts?

Thank you

The for loop will execute as long as the condition (j==Cont_Ultra) is true. When and how many times is j==Cont_Ultra true?

i mean...my second "for loop" can repeat same number of times that Cont_Ultra counts?

I think you want

for(int j=0; j<Cont_Ultra; j++)

groundFungus:
The for loop will execute as long as the condition (j==Cont_Ultra) is true. When and how many times is j==Cont_Ultra true?

I think that it has the same time as Lec_Ultra works, don't you think?

jremington:
I think you want

for(int j=0; j<Cont_Ultra; j++)

My question is...this makes sense? i mean...i need to know how many times the loop enter here

if(Lec_Ultra >= 280)
           {
             digitalWrite(ElecValv_Traslacion_Afuera,RELAY_ON);
             Cont_Ultra++;
           }

alfguardia:

for(int j=0;j==Cont_Ultra;j++)

{
        delay(70);
        digitalWrite(ElecValv_Traslacion_Afuera,RELAY_ON);
       
      }




My question is...j == Cont_Ultra , it can be possible?

If Cont_ultra is zero, then the for condition will execute exactly once. If it is not zero, them the loop will not be executed at all.

This makes sense?

Not a bit.

       Lec_Ultra = analogRead(Ultrasonido);
       delay(50);
       map(Lec_Ultra,0,1023,0,255);

map() returns a value which you throw away. It does NOT modify the input variable.

It is not the mark of the sharpest crayon in the box to use map() to divide by 4.