how join two codes

hi all please I have to join these two programs:
This is for a servo motor :

int valor;
int i;
const int pote = A0;
const int boton_1=3;
const int boton_2=2;
const int dir_a=8;
const int dir_b=7;
const int velo=9;

void setup ()
{
pinMode(boton_1, INPUT);
pinMode(boton_2, INPUT);
pinMode(dir_a, OUTPUT);
pinMode(dir_b, OUTPUT);
digitalWrite(dir_a, LOW);
digitalWrite(dir_b, LOW);
Serial.begin(9600);
}

void loop()
{
valor = analogRead(pote);
valor = map (valor, 0, 1023, 0, 255);
Serial.println(valor);
analogWrite(velo, valor);

if(digitalRead(boton_1)==1)
{
digitalWrite(dir_a,HIGH);
digitalWrite(dir_b,LOW);
}

if(digitalRead(boton_2)==1)
{
digitalWrite(dir_a,LOW);
digitalWrite(dir_b,HIGH);
}

AND THIS OTHER FOR SERVO MOTOR:

#include <Servo.h>
Servo servo_1;
const int pote = A0;
int valor;
void setup()
{
Serial.begin(9600);
servo_1.attach(11);
}
void loop()
{
valor = analogRead(pote);
valor = map(valor, 0,1023, 0,180);
Serial.println(valor);
servo_1.write(valor);
delay(50);
}

I want to unite and work with one arduino ,. please as I do .
Thank you .

I want to unite and work with one arduino

What do you want the resulting program to do?

What have you tried?

Do you really understand what either code is doing? If so, it is trivial to combine them, as long as you know what you want the final program to do.

Both codes have a reading for a pot. Is this the same pot? If not you will have to move one.

thanks the first code upload 1 arduino and the second code upload another arduino, Now I want to load both codes to a single arduino , how to do that how do i

yeah, I 'll change the ports

Read this http://www.thebox.myzen.co.uk/Tutorial/Merging_Code.html

ok, thank you very much

This demo may also be useful.

...R