I had to do that for a class (but with no microcontroller) and here's how I did it: Put two line sensors on either side of the robot, in the front. Space them so they are outside the line on either side (so they don't see the line). Then, when one sees the line, you know you need to turn.
Assuming your robot uses differential steering (i.e. steering like a tank), notice that, when turning right, the front-right corner will move right, in sort of a circle. So, when the robot's right sensor sees a line, you have it stop the right wheel(s) and keep moving forward with the left ones. It will turn right, and as it does, the front-right sensor will be sliding to the right. Eventually, it won't see the line anymore, and then you turn the right wheels back on. In other words, each side's wheels only get power if the sensor on that side doesn't see a line. That is a really quick and dirty way to do it (we only had logic gates for that class, no microcontrollers), and you have to tune things to make it work reliably. And of course the robot stops if both sensors see a line.