const int trig=2;
const int echo=4;
long duration;
int distance;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(trig,OUTPUT);
  pinMode(echo,INPUT);
  pinMode(12, OUTPUT);
  pinMode(14, OUTPUT);
  pinMode(5, OUTPUT);

}

void loop() {
 digitalWrite(trig,LOW);
 delayMicroseconds(2);
 digitalWrite(trig,HIGH);
 delayMicroseconds(10);
 digitalWrite(trig,LOW);
 duration=pulseIn(echo,HIGH);
 distance=(duration*0.034)/2;
Serial.println("distance"+String(distance));
if(distance<=200)
{
digitalWrite(12, HIGH);
digitalWrite(14, HIGH);
digitalWrite(5, HIGH);
}
else
{
digitalWrite(12, LOW);
digitalWrite(14, LOW);
digitalWrite(5, LOW);
}




}