encoder differetial help

Hi new to the arduino.

I'm having difficulty in finding information regarding measuring a difference between two encoders of the same size. Any help in the right direction would be great.

I would like to have the ardunio receive a pulse from one channel of a 200ppr encoder ,as a signal as to drive a dc motor in one direction only,

Then to have the arduino recieve a second signal as a feedback, also a 200ppr encoder one channel only.

I would like the arduino to measure the pulse counts of the encoders , compare them and if theres a difference eg the feedback is behind then increase pwm to the motor to increase its speed to catch up.

Normally called pid .

My problem is how to create the pulse measuring differential code .

YouTube been some help.

Proper stuck now