Dynamic Innovator
Published

I Made A Cap That Doesn't Allows You To Touch Your Face!!!

This is a anti face touch alarm cap that doesnt allows to touch your face.. this is a trainer cap to not to touch our face!!!

IntermediateFull instructions provided2 hours4,981
I Made A Cap That Doesn't Allows You To Touch Your Face!!!

Things used in this project

Story

Read more

Custom parts and enclosures

CAP!!

U CAN USE ANY CAP FOR THIS PROJECT!!!

Schematics

circuit diagram!!!

SEE THE CIRCUIT DIAGRAM AND MAKE THE CONNECTIONS!!!

Code

CODE!!!

Arduino
Anti face touch alarm cap code !!
THIS CODE RUNS IN ARDUINO IDE SOFTWARE.
//Dynamic Innovator
const int trigPin = 9;
const int echoPin = 10;
const int buzzer = 11;
const int ledPin = 13;

// defines variables
long duration;
int distance;
int safetyDistance;


void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
pinMode(buzzer, OUTPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600); // Starts the serial communication
}


void loop() {
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);

// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);

// Calculating the distance
distance= duration*0.034/2;

safetyDistance = distance;
if (safetyDistance <= 22
){ // Enter the Distance
  digitalWrite(buzzer, HIGH);
  digitalWrite(ledPin, HIGH);
}
else{
  digitalWrite(buzzer, LOW);
  digitalWrite(ledPin, LOW);
}

// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.println(distance);
}

Credits

Dynamic Innovator

Dynamic Innovator

2 projects • 4 followers
Hello!!! I like to innovate,think and fabricate... i have an youtube channel!! u can see my projects!!

Comments