Keep Learning.......

Tuesday, July 14, 2020

Contact Less Hand Sanitizing Machine Using Arduino Nano




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);}
}


2 comments:

Types of CCTV Camera