int distance;void setup() { pinMode(13,OUTPUT); pinMode(12,INPUT); pinMode(11,OUTPUT); Serial.begin(9600);
}
void loop() { digitalWrite(13,1); delayMicroseconds(10); digitalWrite(13,0); distance = pulseIn(12,HIGH)/58.2; if(distance)<=10){ digitalWrite(11,0); }if((distance)>10){ digitalWrite(11,1);} Serial.println(distance);