Control 2 Linear actuator with L298 H-Bridge Motor Dirver

Hello guys , i have already made a program based on other examples to control the linear actuator that have a litle motor that creates rotation.

The 9 pin is a buzzer and the relay control a small motor independently.

My problem is that i can´t control the velocity or the time that de actuator is going forward or backwards.

And i would like to make a cycle conter to make my circuit run only 3 times.

i live the code i have and if some one can help i would apreciate very much.

thank you

//Testing the DC Motors
//Define Pins
 //Motor A
 int enableA = 10;
 int pinA1 = 2;
 int pinA2 = 3;
//Motor B
 int enableB = 8;
 int pinB1 = 4;
 int pinB2 = 5;
/*-----( Import needed libraries )-----*/
/*-----( Declare Constants )-----*/
#define RELAY_ON 1
#define RELAY_OFF 0
/*-----( Declare objects )-----*/
/*-----( Declare Variables )-----*/
#define Relay_1  7  // Arduino Digital I/O pin number

void setup()   /****** SETUP: RUNS ONCE ******/
{
// Atuadores
  Serial.begin (9600);
 //configure pin modes
 pinMode (enableA, OUTPUT);
 pinMode (pinA1, OUTPUT);
 pinMode (pinA2, OUTPUT);
pinMode (enableB, OUTPUT);
 pinMode (pinB1, OUTPUT);
 pinMode (pinB2, OUTPUT);
  //-------( Initialize Pins so relays are inactive at reset)----
  digitalWrite(Relay_1, RELAY_OFF);
  
//---( THEN set pins as outputs )----  
  pinMode(Relay_1, OUTPUT);   
  delay(1000); //Check that all relays are inactive at Reset
  // Buzer

  pinMode(9, OUTPUT);   // sets the pin as output


}//--(end setup )---


void loop()   /****** LOOP: RUNS CONSTANTLY ******/
{
  // Teste atuadores
 //enabling motor A
 Serial.println ("Enabling Motor A");
 digitalWrite (enableA, HIGH);
//do something
 //forward
 Serial.println ("Forward");
 digitalWrite (pinA1, HIGH);
 digitalWrite (pinA2, LOW);
//5s forward
 delay (5000);
//reverse
 digitalWrite (pinA1,LOW);
 digitalWrite (pinA2,HIGH);
//5s backwards
 delay (5000);
//stop
 digitalWrite (enableA, LOW);
 delay (2000);
//enabling motor B
 //Since motor B is mounted reversed, PINs must be exchanged
 Serial.println ("Enabling Motor B");
 digitalWrite (enableB, HIGH);
//do something
 //forward
 Serial.println ("Forward");
 digitalWrite (pinB1, LOW);
 digitalWrite (pinB2, HIGH);
//5s forward
 delay (1000);
//reverse
 digitalWrite (pinB1,HIGH);
 digitalWrite (pinB2,LOW);
//5s backwards
 delay (1000);
//stop
 digitalWrite (enableB, LOW);
 delay (500); 
//---( Turn all 4 relays OFF in sequence)---  
  
  
  
   analogWrite(9,128);
     delay(500);
     digitalWrite(9, HIGH);
     delay(100);
     
     
     digitalWrite(Relay_1, RELAY_ON);// set the Relay ON
  delay(400);              // wait for a second
  digitalWrite(Relay_1, RELAY_OFF);// set the Relay OFF
  delay(900);              // wait for a second    
        
}//--(end main loop )---

7 below will show you hoe to post your code.

http://forum.arduino.cc/index.php/topic,148850.0.html