Date created: 07/04/13 19:23:51. Last modified: 04/04/15 10:17:27

Secret Agent Laser Challenge - Part 1

Instantly jealous upon first sight of The Big Bang Theory's Secret Agent Laser Obstacle Chess: http://www.youtube.com/watch?v=IEpi9qAfRaE

Download mp4

The rules are simple. Get through the laser course without setting off the buzzer. If you break it, drink a shot and go back to the start. You can't stop until you make it all the way through without breaking the beam. Physical challengers && booze == Awesome()

All I had to hand for a buzzer though was the banana part of a phone. Step 1, build a quick laser setup;

Project Code:

 
/*
 * Secret Agent Laser Thingy - Stage 1 - Initial Concept
 * Send threats to: [email protected]
 * (suggestions and improvements prefered though!)
 *
 * ...I still don't know what I'm doing...
 */

int photoPin = 0; // Analog 0
int speakerPin = 8; // Digital 8
int intLastLightLevel = 0;
int intThisLightLevel = 0;
int intLightThreshold = 150; // Adjust to your own photocell

void setup() {
  Serial.begin(9600);
}

void loop(){
 intLastLightLevel = intThisLightLevel;
 intThisLightLevel = analogRead(photoPin);
 if (intThisLightLevel<intLightThreshold) {
   if (intLastLightLevel<intLightThreshold) {
     Serial.println("WHOOOP! WHOOOP! DRINK, THEIF!");
     Serial.println(analogRead(photoPin));
     tone(speakerPin,500,100);
   }
 }
 delay(50);
 // This works out as 2x delay for buzzer to trigger
 // so in this case, 100ms
}
 

Initial Test Video mp4


Previous page: SD Card Basics
Next page: Shift Register Hello World