Author Options:

Use a door switch to run script on a computer? Answered

 I'm wondering, how would I go about installing and configuring a door switch hooked up to a computer and having the computer run a program or script when the switch is activated..lets say, when the door is opened. or even better, have several switched and have each switch activate a different script or application?


Have your computer program looking for a switch closure on the usb data line, serial data line or one of the parallel port data lines.  The only hardware needed is cable, switch and connector.

On switch closure your program can do it's thing.

probably the simplist way would be using an arduino w/ usb cable and running Processing (it's a program).  I have no expierience with Processing, but it's probably what you want.  There are cheaper solutions than the arduino, but they are more complicated.  Like you could use a single Attiny45 running v-usb to communicate with your computer, but that is much more advance than arduino Processing combo