It will be much easier to help if you post the program that represents your best attempt and a photo of a simple pencil drawing showing how you have everything connected.
Also please post a link to the datasheet for your motor and tell us what motor driver you are using.