Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
viniciuslindoss
Published © LGPL

Parking Sensor with Arduino

This parking sensor with Arduino is an easy project.

BeginnerShowcase (no instructions)1 hour54,648
Parking Sensor with Arduino

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Buzzer
Buzzer
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

hardware

Code

hardware

C/C++
// 6 trig , 5 echo
#include <Ultrasonic.h>
Ultrasonic ultrasonic(6,5);// 6 trig , 5 echo


const int buzzer = 7; // pin buzzer

void setup(){
 pinMode(buzzer,OUTPUT);

}

void loop(){
 int dist = ultrasonic.Ranging(CM);
if (dist < 100) {
  tone(buzzer,1000);
     delay(40);
   noTone(buzzer);
     delay(dist*4);
   }
 delay(100); 
} 

Credits

viniciuslindoss
0 projects • 13 followers

Comments