To control an actuators direction and speed using an Arudino

Hi I am new to Arduino,

I have been trying to run an actuator using an arduino and have failed would anyone please help me with the basics.

So the actuator is a DC motor with rotary encoder and the Pin layout has

Pin # Name Pin # Name
1 Motor+ 6 Motor -
2 Encoder+V 7 Limit ground
3 Encoder Ch A 8 No connection
4 Encoder Ch B 9 Reverse limit
5 Ground (case) 10 Forward limit

Using Pin 1 and Pin 6 I am trying change the direction of this actuator and would like to use the encoder ch A and Ch B to control the speed using an Arduino Uno.

The actuator works if i connect the 5V from the arduino board to Pin 1 and GND from arduino to Pin 6 and it changes direction when i swap the 2 pins manually but I would appreciate it if anyone could help me code this direction change through arduino.

Thank you

What you need is an H-bridge. There are many H-bridge motor driver modules made. Pololu (among others) carries many modules of various voltage and current ratings. The correct H-bridge for your motor depends on the rated voltage and stall current of the motor. It is a bad idea to power a motor from the Uno 5V supply. The Uno cannot safely supply the required current for any but the very smallest of motors.