int trig(12);
int echo(11);
int a(10);
int b(9);
int c(8);
int buzzer(6);
int time;
int distance;
void setup() 
{
  Serial.begin(9600);
  pinMode(trig, OUTPUT);
  pinMode(echo, INPUT);
  pinMode(a, OUTPUT);
  pinMode(b, OUTPUT);
  pinMode(c, OUTPUT);
  pinMode(buzzer, OUTPUT);
  // put your setup code here, to run once:

}

void loop() {
  digitalWrite(trig, LOW);
  delayMicroseconds(2);
  digitalWrite(trig, HIGH);
  delayMicroseconds(10);
  digitalWrite(trig, LOW);
  time = pulseIn(echo, HIGH);
  distance = (0.034*time)/2;
  Serial.print("Distance = ");
  Serial.println(distance);
  if (distance<=100){
    digitalWrite(a, HIGH);
    digitalWrite(b, LOW);
    digitalWrite(c, LOW);
    digitalWrite(buzzer, LOW);
    delay(500);
  }
  else if((distance>100) and (distance<=389))
  {
    digitalWrite(a, LOW);
    digitalWrite(b, HIGH);
    digitalWrite(c, LOW);
    digitalWrite(buzzer, LOW);
    delay(500);
  }
  else if((distance>390))
  {
    digitalWrite(a, LOW);
    digitalWrite(b, LOW);
    digitalWrite(c, HIGH);
    digitalWrite(buzzer, HIGH);
    delay(500);
  }  // put your main code here, to run repeatedly:
}