Contact Less Hand Sanitizing Machine Using Arduino Nano
Code
long t; // To store Transit Time
float x; // To Store Se sing Distance
void setup() {
// put your setup code here, to run once:
pinMode (3,OUTPUT);
pinMode (4,INPUT);
pinMode (2,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(3,LOW);
delayMicroseconds(2);
digitalWrite(3,HIGH);
delayMicroseconds(10);
digitalWrite(3,LOW);
delayMicroseconds(2);
t=pulseIn(4,HIGH);
x=t*343/20000;
if (x<11 )
{digitalWrite (2,HIGH);}
else
{digitalWrite (2,LOW);}
}
please mention the name of pins 2 3 4
ReplyDeleteNice n thanks
ReplyDelete