Need help - slide potentiometer

I am using a slide potentiometer to change the direction of a motor. Please tell me how to connect it to the arduino and what will be the coding.

Thanks

UCK

Please tell us what hardware you have to drive the motor, and how you have wired it up?

You wire up a slider exactly like a rotary pot, one end of the track to 5V the other end to ground and the center tap to an analogue input.

what will be the coding.

It will look at the analogue input and will compare the value received to a fixed value using several if statements to decide if the motor is on or off or turning clockwise or anticlockwise. The the body of the if statement will set the appropriate output pins on the Arduino to make your motor do that. The exact details of that depends on what motor driver you are using. For bi-directional motor movement you need a H-bridge circuit.

uck:
I am using a slide potentiometer to change the direction of a motor. Please tell me how to connect it to the arduino and what will be the coding.

Thanks

UCK

Pin-outs vary, you either look this up in the datasheet or measure with a multimeter. You need a linear
law pot, not a log-law, note.

Once you've identified the wiper then it goes to an analog pin, and the ends of the track go to 5V and GND.

Then you can call analogRead() - the rest is programming.

You do the coding yourself. That is one of the beautiful features of an Arduino.

If you cannot or will not do the coding yourself, then post something in "Gigs and Collaborations," and bring your wallet.

And if you ARE going to do the coding yourself, it is a good idea to do it in small steps.
Just hook up the pot. Read the value and print it to the monitor.
Slide the pot and see the values on the monitor change. There are potentiometer tutorials online or in the arduino examples (I think it is called AnalogInput).

Then as a different sketch, wrote code to run the motor. Have the motor run forward for a few seconds. Stop the motor for a few seconds. If your driver is capable, have the motor run backwards for a few seconds. And then again stop for a few seconds. There are likely tutorials on the web site where you purchased the motor driver.

Then try to combine the 2.

Let us know how it goes. Let us know if you run into problems while you are trying this.