#include  <ESP32Servo.h>
Servo servo;
int rouge = 5;
int vert = 18; 
int trig = 12; 
int echo; = 13;

void setup() {
pinMode(rouge, OUTPUT);  
pinMode(vert, OUTPUT);
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
servo.attach(26);
pinMode(4, INPUT);
}

void loop() {

digitalWrite(trig,1);
delay(10);
digitalWrite(trig,0);
int distance = pulsein(echo,1) * 0.034/2;


if (distance < 100){
                   angle = 0

                  servowrite(0);
                  digitalWrite(rouge,1);
                  delay(100);
                  digitalwrite(rouge,0)
                  digitalWrite(vert,1);
                  delay(100);
                  digitalWrite(vert,0);
}
else{
    servo.write(90);
    }
}