Newbie :),Question about DC MOTOR and Relay

Hi ,i m a newbie

I have 3 dc gear motor (50 rpm) , H Bridge(x2) ,breadboard,12 v supply,arduino board and relay

i want to control speed and direction of 2 motor and work in relate with the other

first , i write a code for test control speed (pwm) and direction like this

int PWM1 = 9; int PWM2 = 11; int DIR1A = 6; int DIR1B = 10; int DIR2A = 5; int DIR2B = 13;

void setup() {

pinMode(DIR1A,OUTPUT); pinMode(DIR1B,OUTPUT); pinMode(DIR2A,OUTPUT); pinMode(DIR2B,OUTPUT); }

void loop() {

analogWrite(PWM1,200); digitalWrite(DIR1A,HIGH); digitalWrite(DIR1B,LOW); analogWrite(PWM2,200); digitalWrite(DIR2A,LOW); digitalWrite(DIR2B,HIGH); }

and then i want to use relay to control last dc motor but i dont know how to connect a wire and addition my code if i want to do in condition


(1,2) dc motor run different direction by speed 1 round per second and then stop (3) dc motor run speed 1 round per second then stop

thank for answer :)