Some question about PID control

Hi,

I would like to make a car which has two wheels in order to make it turn. I want to let it trace black line. Because of this target, I bought a IR sensor in order to sense the color under my car is black or white.

Then I installed my sensor and L298N board which can not only control motor but also control motor speed by PWM signal on my car. when I started the test, the car could trace the black line at first. Before long, the car can't trace the line anymore.

I wanted to solve this problem and searched some information on the internet. I found a algorithm called PID. I also found Arduino has PID library. But my problem is still not solved.

Please tell me how to use the PID library and how to apply it to my car

Thanks

P.S. this is the website I download PID library: Arduino Playground - PIDLibrary