Introduction
Ever seen grids of laser beams protecting valuables? Then you've probably seen a laser sensor module at work. The laser beams may seem high-tech, but the principles behind them are simple.Â
In this guide, you will get familiar with the laser sensor module and use it with an Arduino to create a simple tripwire alarm system. It will let you know if anyone is sneaking about!
After completing this guide, you will understand how to use a laser sensor module and can go on to create projects of your own!Â
Tools
-
-
-
-
-
-
-
-
-
-
-
int ldr = 0; //analog pin to which LDR is connected int ldr_value = 0; //variable to store LDR values const int buzzer = 9; void setup() { Serial.begin(9600); //start the serial monitor } void loop() { ldr_value = analogRead(ldr); //reads the LDR values Serial.println(ldr_value); //prints the LDR values to serial monitor delay(100); //wait if (ldr_value < 600) { tone(buzzer, 1000); delay(3000); // 3 seconds of beeping to tell you the trip wire has been broken } else { noTone(buzzer); } }
-