Processing input emulation

I have the hardware side totally working at this point, the only problem is mouse emulation.
I am pulling both pins up, then hooking the two leads from the DC motor to them. When I spin the motor, which I am using as a makeshift encoder (kludgy, yeah, but I don't have an optical encoder, and it fits perfectly), one pin gets pulled down, and the serial output is (pin1 - pin2), so it outputs the difference between them. Pulling them up is to keep them from floating and randomly scrolling tiny amounts.
A "linear webpage scroller" is like http://www.instructables.com/id/Spinner-Jog-Wheel-Inside-of-a-VCR-Head/, but linear instead of circular. You know, for ebooks and long webpages.