DC Motor Control

Hi,
I just purchased a flex sensor. It seems to be working fine. I need some help with it. Every time, the value of the flex sensor reduces by 5k I want a dc geared motor to spin for .5 sec and for every 5k increase, it must pin in anti clock wise directioni for .5 sec. Could some one please give me a code for this.

Thankyou
Regards

Please don't cross-post: