3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Another Arduino Laser Tripwire

Step 4The Code

Upload the following sketch but adjust the value in the "if" statement to suit your photocell. Pick a number a bit above the ambient light number. This may need tweaking later, or, just pull a curtain or shrpud the photocell to lower the ambient light in the room.

/*
*/

int buzzPin = 11; // buzzer connected to digital pin 11

void setup() {
pinMode(buzzPin, OUTPUT); // sets the digital pin as output
}

void loop(){
if(analogRead(0) < 850){ // this number depends on calibration of the photocell
digitalWrite(buzzPin, HIGH); // turns buzzer on
delay(1000); // waits for 1 second
digitalWrite(buzzPin, LOW); // turns buzzer off

} else{
digitalWrite(buzzPin, LOW);
}
}
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
8
Followers
4
Author:Jonathan Robson
Science museum exhibit design and fabrication manager, stagehand, ballet shoe maker, theatre production manager, project manager and art director of the Beijing Aquarium rainforest exhibit, film extra...
more »