DIYmall Laser Transmitter Receiver Module Buzzer with Arduino

What you need:
1PCS Arduino UNO
1PCS  Laser Transmitter Sensor
1PCS  Laser Receiver  Sensor
1PCS Buzzer
A Few PCS Female to Male Dupont Cable

Connection:
Laser Transmitter Sensor                Arduino UNO
S                                                                       D12
+                                                                       5V
–                                                                        GND

Laser Receiver  Sensor                Arduino UNO
S                                                                       D2
+                                                                       5V
–                                                                        GND

Buzzer                                                   Arduino UNO
–                                                                     GND
+                                                                      D8

Code:

int Active = 8;
int LaserSensor = 2;
int SensorReading = HIGH;
int Laser = 12;

void setup() {
pinMode(Active, OUTPUT);
pinMode(Laser, OUTPUT);
pinMode(LaserSensor, INPUT);

}
void loop() {
digitalWrite(Laser, HIGH);
delay(50);
SensorReading = digitalRead(LaserSensor);
if(SensorReading == (HIGH)

{
digitalWrite(Active, HIGH);
}
else
{
digitalWrite(Active, LOW);
}
}

Result:  
When there is an obstacle, the buzzer will turn on
When there is no obstacle, the buzzer will turn off

Where to buy:
Amazon Link:
https://www.amazon.com/dp/B07FQ6696X

https://www.amazon.com/dp/B07H95679S

Website Link:

Alibaba Link:

Aliexpress Link:

eBay Link:

 

Any question please email sales@diymalls.com

Leave a Reply

Your email address will not be published. Required fields are marked *