Arduino Line Follower Help

Hi,

I am making a vehicle in class that is suppose to travel across a two-walled course, and cross a black finish line. I am having trouble figuring out what I am suppose to code for the line follower to work. Basically, once the vehicle crosses the black finish line, the vehicle is suppose to stop. My vehicle runs, but it doesn't stop when it senses a black line, and so I'm wondering how to code this or what to use?

Thank you for your time.

int rightmotor = 5; //pin5
int leftmotor = 6; //pin6
int rightbumper = 7; //pin7
int leftbumper = 8; //pin8
int linefollower = 0;
int increasespeed = 30;
int speed1 = 150; //left motor
int speed2 = 150; //right motor
int switchstate1; //left
int switchstate2; //right

void setup() {
  Serial.begin(9600);
  pinMode(leftmotor, OUTPUT);
  pinMode(rightmotor, OUTPUT);
  pinMode(leftbumper, INPUT);
  pinMode(rightbumper, INPUT);
}

void loop(){
    linefollower = analogRead(A0); //this is the part i need help with
    Serial.println(linefollower); //this is the part i need help with
    analogWrite(leftmotor, speed1);
    analogWrite(rightmotor, speed2);
    switchstate1 = digitalRead(leftbumper);
    switchstate2 = digitalRead(rightbumper);

    if(switchstate1 == HIGH && switchstate2 == HIGH){
      speed1;
      speed2;}

    if(switchstate1 == HIGH && switchstate2 == LOW){
      speed1 = speed1 + increasespeed;
      speed2 = speed2 - increasespeed;
    }
    
    if(switchstate1 == LOW && switchstate2 == HIGH){
      speed1 = speed1 - increasespeed;
      speed2 = speed2 + increasespeed;
    }
  }
if(switchstate1 == HIGH && switchstate2 == HIGH){
      speed1;
      speed2;}

speed1 speed2 what?

@AWOL I set both speed1 and speed2 equal to 150, and then I just wrote the variable in the if statement. I don't know if I was suppose to do that, but my vehicle runs still, so I left it there.

I don't know if I was suppose to do that, but my vehicle runs still, so I left it there.

You could put

   47;
   3.14159;

in your code, and the two lines would be just as useless but benign.

    linefollower = analogRead(A0); //this is the part i need help with

What help do you need? We have no idea what you have connected to analog pin 0 OR why you think the value should be called linefollower. Maybe the program would work better if you named the variable thomasedison.