How to control actuator speed and direction using potentiometer

I need to be able to control speed and direction where when I move the potentiometer to the right it would go down and when I move it to the left it would go up. Please guys let me know what I need to buy?

The attached program does this. You have not explained what happens when the actuator reaches the limit at one end or the other but this program monitors the potentiometer. It prints the Direction and Speed. It continues to drive in that direction as long as the pot input is not at zero. (middle of the pot) . It drive in FORWARD direction for any count above 512 at a speed based on the Map function. It drives in the opposite direction for any count less than 513 at a speed based on the MAP FUNCTION. it continues to loop setting the direction at the beginning. In the middle of the pot, it will apply a low voltage in the 100mV range so the motor will barely move.. The motor driver is a DK Electronics Motor Shield which is a Full H-Bridge L293 based driver. There are numerous high current bidirectional Full H-bridge digital PWM motor drivers available on the net but you need to make sure you get one that has the "DIR" input pin and the "PWM" input pin . If it has those it will also have an ENable pin. Some of them are dual drivers for driving two motors. There are quite a few that have a potentiometer mounted to the PCB. Some of them use the pot as a speed control and some are set up like this program where the middle of the pot defines ZERO (no direction/no speed) and as the pot is turned in the positive direction the speed is set to forward and the speed is dependent on the position of the pot between midpoint and maximum positive endpoint. The reverse is true for the negative direction.If the pot is moved below the midpoint the direction is set to reverse and speed is a function of the wiper position between midpoint and maximum NEGATIVE endpoint. In the middle the motor is stopped. some of them have a "brake" function that shorts the motor leads if the wiper is in the middle region.within 50 or so counts of the midpoint. In the case of a flight simulator , this braking function would be desirable to prevent the weight of the simulator from moving the motor. I am not aware of any Motor Stop function (You can enable the Motor Release statement I commented out) in the Adafruit Motor Library so if anyone knows how to do that please jump in. Also, you may need to make a few changes to the code to work with the driver you select. If you get the ones that are already set up for bidirectional control via a pot then you won't have any input pins to use for uC control. Read the datasheets before you buy and make sure it is rated for enough current. You have not told us what the current (in Amps) rating is for your actuator and have not replied to that questions so that ball is in your court.

http://www.aliexpress.com/store/product/Free-shipping-New-0-24V-Dual-30A-H-Bridge-DC-Motor-Driver-Peak-60A-for-Robot/710410_634914339.html

 // Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!

#include <AFMotor.h>
int STATE =0;
int val=0;
AF_DCMotor motor(1);
int  pot =A0;
int  pot1 =A1;
int  pot2 =A2;
int  pot3 =A3;
int  pot4 =A4;
int  pot5 =A5;
void setup()
{
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Motor test!");
  pinMode(pot,INPUT);
  // turn on motor
  motor.setSpeed(200);
 
  motor.run(RELEASE);
}

void loop()
{
  // uint8_t i;
  
  
  
   int val = analogRead(pot);
   Serial.print("pot= ");
   Serial.println(val);
   if (val>512)
       STATE =1;
   if (val<513)
       STATE =2;
     
  
   switch (STATE) 
  {
    case 1:
      //do something when var equals 1
          Serial.println("FORWARD");
          motor.run(FORWARD);
          val = map(val,513, 1023, 0, 255);
           Serial.print("val= ");
           Serial.println(val);
          motor.setSpeed(val);  
          delay(1000);
          
      break;
    case 2:
      //do something when var equals 2
           Serial.println("REVERSE"); 
          motor.run(BACKWARD);
          val = map(val, 512, 0, 0, 255);
          Serial.print("val= ");
           Serial.println(val);
          motor.setSpeed(val);  
          delay(1000);
      break;
    default: 
      // if nothing else matches, do the default
      // default is optional
      delay(10);
  }
    
 
  Serial.println("tech");
  //motor.run(RELEASE);
  delay(1000);
}

ACTUATOR_no_delay.ino (1.46 KB)