Laser Trap Alarm using a Photocell and KY-008 by sandbird

Cloned from Sketch Button States - For controling Laser Calib by sandbird

This sketch is missing a short description
====================== Laser Trap Alarm ====================== Synopsis: Use a photoresistor (or photocell) and a KY-008 laser to make a laser trap. If something breaks the beam the alarm will go off, blinking an RGB light (optional) and make a siren sound through a speaker (optional). ============================================================ Details: For the first 5 seconds a blue light will blink 3 times. After that a green light will indicate that you can enter calibration mode if you want (10 seconds wait). Pressing the button will pause the main detection algorithm and allow you to calibrate the beam for 5 minutes. Since a typical setup would be to have a mirror opposite the laser head which will reflect the light back to the photocell, a 5 minute wait is sufficient. When you have aligned the beam, you can unplug/plug back the device if you don't want to wait. When the main loop activates it will monitor the current photocell value. If that value drops/raises 100 points, the alarm will go off. ============================================================ Materials: - 1xKY-008 - 2x10KOhm resistors (photocell and button) - 1xPhotocell - 1xRBG Led - 3x1KOhm resistors (RGB LED, one on each color pin) - 1xSpeaker - 1xArduino Pro Micro (or any other) ============================================================ Notes: The 10KOhm resistor on the photocell is used to make the photocell output 0-1023 values. The RGB light and the speaker are optional, and so are the resistors they use...but you need to have some type of indication that the alarm went off :)

Embed This Sketch

Use the following HTML code to embed the sketch code above in your blog or website.

<iframe style="height: 510px; width: 100%; margin: 10px 0 10px;" allowTransparency="true" src="https://codebender.cc/embed/sketch:242696" frameborder="0"></iframe>

Embed The Serial Monitor

You can also embed the Serial Monitor section! Just use this HTML code.

<iframe style="height: 510px; width: 100%; margin: 10px 0 10px;" allowTransparency="true" src="https://codebender.cc/embed/serialmonitor" frameborder="0"></iframe>