int echo =10;
int trig = 11;
int distance = 0;
int led[3] = {3,4,5};
void setup() {
  // put your setup code here, to run once:
  pinMode(echo,INPUT);
  pinMode(trig, OUTPUT);
  for(int i=0;i<3;i++)
      pinMode(led[i],OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(trig,LOW);
  delayMicroseconds(2);
  digitalWrite(trig,HIGH);
  delayMicroseconds(10);
  digitalWrite(trig,LOW);
  distance = pulseIn(echo,HIGH);
  distance = distance /58;
  for(int i=0;i<3;i++)
  digitalWrite(led[i],LOW);
  if(distance < 50)
  digitalWrite(led[0], HIGH);
  else if (distance < 150)
  digitalWrite(led[1], HIGH);
  else
  digitalWrite(led[2], HIGH);

  

}