Help with PID loop for Arduino motor speed

Job ID: 31661840

Budget: $10 – $30 AUD

I'd like some help with a PID loop for an Arduino project please.

It's a film scanner where a motor pulls film along at a constant rate.
I have a single servo motor pulling film along, there is a light sensor creating pulses each time it hits a perforation/hole in the film.

I'd like the pulses to dictate the speed of the motor, say 18 pulses per second.

I have a basic code using an uno and motor shield to get the motor running and interrupt working with the encoder.

I'm just struggling to get started making a PID loop. If you could just get me started with some code that is working for me, that would be ideal.