Touchless Doorbell
No more spreading germs through doorbells.
Components and supplies
1
Buzzer
1
Ultrasonic Sensor - HC-SR04 (Generic)
1
Arduino UNO
Project description
Code
Doorbell
c_cpp
Comments
Only logged in users can leave comments
Components and supplies
Buzzer
Ultrasonic Sensor - HC-SR04 (Generic)
Arduino UNO
Project description
Code
Doorbell
c_cpp
1/* 2'DISTANCE SENSOR: 3Vcc goes to 5V on arduino 4Gnd goes to ground pin on arduino. 5Trigger goes to pin 8 on the arduino. 6Echo goes to pin 9 on the arduino. 7 8BUZZER: 9Positive leg goes to pin 12 on the arduino. 10Negative leg goes to GND on arduino. 11*/ 12int trigPin = 8; 13int echoPin = 9; 14 15 16void setup() { 17 pinMode(trigPin, OUTPUT); 18 pinMode(echoPin, INPUT); 19 delay(100); 20} 21 22void loop() { 23 24 digitalWrite(trigPin, LOW); 25 delayMicroseconds(5); 26 digitalWrite(trigPin, HIGH); 27 delayMicroseconds(10); 28 digitalWrite(trigPin, LOW); 29 30 int duration = pulseIn(echoPin, HIGH); 31 delay(50); 32 33 if (duration <= 600){ 34 tone(12, 2000, 3000); 35 } 36 37 else{ 38 noTone(12); 39 40 } 41}
Comments
Only logged in users can leave comments