function ''if'' is not working or did i write it wrong?

Hi guys, I wrote sketch for my linefollowing robot and it doesntwork as i expected. Here is part of code (rovno means forward, vlavo is left and vpravo is right ;) )

void loop() {
int s1=digitalRead(8);
int s2=digitalRead(7);
int s3=digitalRead(6);
int s4=digitalRead(5);
int s5=digitalRead(4);
int s6=digitalRead(3);
int s7=digitalRead(2);
  if(s4 == 0)rovno;
  else {
    if(s1 == 0){
      vlavo90();
    }
    else{
     if(s7 == 0){
       vpravo90();
     }
     else{
      if (s2 == 0) vlavo();
      else{
       if (s6 == 0) vpravo();
       else{
        if (s3 == 0)vlavo();
        else{
         if (s5 == 0)vpravo();
         else {
           rovno();
         }
        } 
       }
      } 
     }
    } 
  }
}

1 is white and 0 is black line .s1-7 are sensors. s4 is the middle one.if the middle sensor is on the blsck line then it goes forwards and robot doesnt care abouth any others sensors, right? because that's how it DOESN'T work. it goes forward only when all sensors are 1. My robot is going from one side to another and never forward. can anyone help?

try this:

 if(s4 == 0)
{
      rovno;
}
else if (s1 == 0)
{
      vlavo90();
}
else if(s7 == 0)
{
       vpravo90();
}
.
.
.
.
.
.
and so on....
  if(s4 == 0)rovno;

You forgot ‘()’ after ‘rovno’.

parenthesis was missing. thanks so much. :sweat_smile: i must be blind :sweat_smile: