Arduino PID Motor Controller

Exactly what I was looking for!

Thanks so much for posting this.  I do have a question as it relates to calculating the RPM:

In your code, is the following calculating the RPM based upon a 30 pulse per rotation encoder?

//Calculating the speed using encoder count

speed_act = ((count - countAnt)(60(1000/LOOPTIME)))/(30);