How to program the line tracker?

I have been trying to write a basic program using EasyC V4 for the line tracker. I can’t seem to get it to work. So far, it seems like I’m close as after the robot drives past the line, it starts to go in a circle trying to find the line, but after passing over it again it just keeps trying to find it. I’m not sure how I can get my code in here, but I can describe it. I have a while loop, and inside that, I have the line follower blocks, the ones that are just lineleft = GetAnalongInput (1), I have 2 of them because I am using 2 sensors. Then below that I have an If statement saying If lineleft > 500 stop the right motor so it turns left and puts itself back on track, and the exact same thing for the right sensor. My sensors are placed correctly, about 1/8th inch from the surface of the line. Someone else suggested using a line made of tape? Currently I have a line drawn out in sharpie, it’s between half an inch and an inch thick. Would 3 sensors work better? Can anyone assist me with the code?

Wait, are you trying to find the line or follow it?

If you are on the line and just want to stay on it, you can basically let the robot slowly drive to the left when it’s the right sensor sees the ground and to the right when its off on the left. This should keep your robot driving on the line.

very good, I think the equipment is necessary for us. I look forward to your application will be popular.

I’ve done everything the easyC tutorial has and it does follow the line. The issue now is, when the left or right sensor picks up the line it turns like it is suppose to. Only it doesn’t stop even when the middle sensor is above the line, it just continues in a circle and I can’t seem to make it start going straight again. Can someone help me figure this out?