Created
September 18, 2018 09:56
-
-
Save nesendal/87b65618b3346b9c0367acce4aadace4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
*/ | |
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