Potentiometer Controlled Motor with Feedback

how would I go about coding the output signal such that as the difference between the two pots decreased the ratio of high to low time of the pulse decreased as well (effectively slowing the speed of the motor)?

A first stab at the problem might use the map function