ASER Lesson 6.5: Raiders-Style Booby Trap
I just threw together this simple mod of the basic trip wire setup. This one is a little better for keeping people from grabbing your stu...
I just threw together this simple mod of the basic trip wire setup. This one is a little better for keeping people from grabbing your stuff. Well, at least to alert you that they've grabbed your stuff.
I've modified the code to use the analog input like we use in the laser trip wire, and I've just rigged up a simple switch with duct tape so that it only closes when you put pressure on it.
It's finicky, but it'd get the job done. Here is the code to make it run.
// the setup routine runs once when you press reset: void setup() { pinMode(13, OUTPUT); } // the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0: int sensorValue = analogRead(A0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V): float voltage = sensorValue * (5.0 / 1023.0); // only turn it on if the voltage is less than 4 V if(voltage<4){ digitalWrite(13,HIGH); }else{ digitalWrite(13,LOW); } }