Controlling LED's Using Ultrasonic Distance Sensor
Maybe your like
Embed the widget on your own site
Add the following snippet to your HTML:

Turns the 2 LED's on and off by calculating the distance of the object from the Ultrasonic Sensor.
Read up about this project on 
Controlling LED's Using Ultrasonic Distance Sensor
blackpanda8563 25,893
blackpanda856Published January 17, 2022 © GPL3+Controlling LED's Using Ultrasonic Distance SensorTurns the 2 LED's on and off by calculating the distance of the object from the Ultrasonic Sensor.
IntermediateFull instructions provided25,893Things used in this project
Hardware components | |||||
![]() |
| × | 1 |
| |
![]() |
| × | 1 |
| |
![]() |
| × | 1 | ||
![]() |
| × | 1 | ||
![]() |
| × | 2 | ||
![]() |
| × | 1 |
| |
![]() |
| × | 1 | ||
Software apps and online services | |||||
![]() |
| ||||
Hand tools and fabrication machines | |||||
![]() |
| ||||
Story
ThisisaBeginnerproject. The green led glows and red led switches off when the object is a particular distance far from the UltrasonicDistanceSensor.
The red led glows and green led switches off when the object is a particular distance near to the UltrasonicDistance Sensor.
YouTubeChannel:J4Jevins
Link :- https://youtube.com/J4Jevins
Read moreSchematics
Circuit Diagram
This is the Circuit Diagram of this project. Assemble your project by following this circuit diagram.Code
- Code
Code
C/C++This is the code of this project. Copy paste this code to your Arduino IDE.#define Trigpin 7 #define Echopin 8 #define low_led 9 #define high_led 10 float distance; int duration; int ll = 700; void setup() { pinMode (Trigpin, OUTPUT); pinMode (low_led, OUTPUT); pinMode (high_led, OUTPUT); pinMode (Echopin, INPUT); Serial.begin(9600); Serial.println ("Welcome To Distance Meter"); Serial.println ("Coded By Jevins Annson"); digitalWrite (low_led, LOW); digitalWrite (high_led, LOW); } void loop() { digitalWrite(Trigpin, LOW); delayMicroseconds(2); digitalWrite(Trigpin, HIGH); delayMicroseconds(10); digitalWrite(Trigpin, LOW); duration = pulseIn(Echopin, HIGH); distance = duration * 0.034 / 2; delay (ll); Serial.println (" "); Serial.print ("Distance = "); Serial.print (distance); Serial.print (" CM"); Serial.println (" "); if (distance>=30) { Serial.println ("Nobody Is Infront Of the Sensor"); digitalWrite (low_led, HIGH); delay (500); digitalWrite (low_led, LOW); delay (500); digitalWrite (low_led, HIGH); } else { Serial.println ("Someone Is Infront Of the Sensor"); digitalWrite (high_led, HIGH); delay (100); digitalWrite (high_led, LOW); delay (100); digitalWrite (high_led, HIGH); delay (100); } }Credits

blackpanda856
2 projects • 4 followersFollowComments
Related channels and tags
- arduino
- communication
- data collection
- kids
- lights
- monitoring
- tracking
- ultrasonic sensor
Tag » Arduino Hc-sr04 Led
-
Simple Project With The Ultrasonic Sensor (HC-SR04) +LED
-
Arduino HC-SR04 + LED : 5 Steps (with Pictures) - Instructables
-
Controlling LED's Using Ultrasonic Distance Sensor - Arduino Cloud
-
Find Distance With LEDs And Ultrasonic Sensor - Arduino Project Hub
-
Arduino Ultrasonic Sensor Led Projects | Hc-sr04 ... - YouTube
-
Ultrasonic Sensor - LED | Arduino Tutorial
-
Ultrasonic Sensor With Arduino - Coderdojo Athlone
-
Using-ultrasonic-sensor-with-arduino/hc-sr04-o At Master
-
[GUIDE] Arduino Utiliser Un Capteur De Distance HC-SR04
-
Simple Project With The Ultrasonic Sensor (HC-SR04) +LED - Pinterest
-
Ultrasonic Sensor HC-SR04 LED If Else By Churchjw - Codebender
-
Tuto-Arduino Utiliser Un Module Ultrason HC-SR04 - Memorandum
-
Complete Guide For Ultrasonic Sensor HC-SR04 With Arduino
-
Distance Sensor Hc-Sr04 और Led Project - Mechanic37
_ztBMuBhMHo.jpg?auto=compress%2Cformat&w=48&h=48&fit=fill&bg=ffffff)













