I ave got a probleme!

Hello; I would like to know if it is possible to take a piece of code a next to the 'loop' that is repeated for ever.

Thank you in advance.

Don't understand the question.

I would like trasmit the ultasonic and drive moteur at the same time.

And what happened when you tried ?
(bear in mind you should ping an ultrasonic ranger no more than 20 - 30 times a second)

I still do not try anything

LOLO:
I still do not try anything

Please provide a code example of what you want to do (in correct code tags for the forum, please)

#include<Servo.h>
Servo servo;
int position_A = 50;
int position_B = 90;
int position_C = 130;

const int moteurS1 = 2;
const int moteurS2 = 3;

const int moteurAS1 = 4;
const int moteurAS2 = 5;

const char DOUT_TRIGGER = 7;
const char DIN_ECHO = 6;

float distance=21;

void setup() {
servo.attach(9);
servo.write(90);
delay(1000);

pinMode(DOUT_TRIGGER, OUTPUT);
pinMode(DIN_ECHO, INPUT);

pinMode(moteurS1, OUTPUT);
pinMode(moteurS2, OUTPUT);

pinMode(moteurAS1, OUTPUT);
pinMode(moteurAS2, OUTPUT);

}

void loop() {
digitalWrite(DOUT_TRIGGER, LOW);
delayMicroseconds(2);
digitalWrite(DOUT_TRIGGER, HIGH);
delayMicroseconds(10);
distance= pulseIn (DIN_ECHO, HICH)/58;

digitalWrite(moteurS1, HIGH);

servo.write(position_A);
if (distance <= 20)
{
digitalWrite(moteurAS1, HIGH);
delay(1000);
digitalWrite(moteurAS1, LOW);
}
else{
delay(300);
}

servo.write(position_B);
if (distance <= 20)
{
digitalWrite (moteurAS1,HIGH);
digitalWrite (moteurS1, LOW);
digitalWrite (moteurS2,HIGH);
delay(1000);
digitalWrite (moteurAS1, LOW);
digitalWrite (moteurS1, HIGH);
digitalWrite (moteurS2, LOW);
}else {
delay(300);
}

servo.write(position_C);
if (distance<= 20)
{
digitalWrite (moteurAS2,HIGH);
delay(1000);
digitalWrite (moteurAS2,LOW);
}else {

delay(300);
}

servo.write(position_B);
if (distance <= 20)
{
digitalWrite (moteurAS1,HIGH);
digitalWrite (moteurS1, LOW);
digitalWrite (moteurS2,HIGH);
delay(1000);
digitalWrite (moteurAS1, LOW);
digitalWrite (moteurS1, HIGH);
digitalWrite (moteurS2, LOW);
}else {
delay(300);
}

aarg: (in correct code tags for the forum, please)

You are attempting to create functions. That is a good thing. Google "C++ functions".