Instantly share code, notes, and snippets.

Embed
What would you like to do?
/*
*/
void setup() {
//put your setup code here, to run once:
pinMode(9,OUTPUT);
pinMode(8,INPUT);
pinMode(4,OUTPUT);
}
void loop() {
//put your main code here, to run repeatedly:
long sure,mesafe;
digitalWrite(9,LOW);
delayMicroseconds(2);
digitalWrite(9,HIGH);
delayMicroseconds(10);
digitalWrite(9,LOW);
sure=pulseIn(8,HIGH);
mesafe=(sure/2)29.1;
if(mesafe<5)
{
digitalWrite(4,HIGH);
}
else
{
digitalWrite(4,LOW);
}
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment