It can definitely be done.  We are doing something similar right now to 
log when an operator goes through Brad's office to leave the computer room 
(they're not supposed to).  Using a simple foil switch nailed to the door 
frame.

I originally wrote a C program to do it about 7 years ago.  The basic 
premise is open the serial port, write 2 bytes, then read them back.  If 
the read fails, the switch is open.  If the read succeeds, the switch is 
closed. Wait a few ms, then do it again.

Jason Fried (he's on the list) has all the info on our current setup...he 
may even remember which pins trigger the switch.  If he's not too busy 
slacking, he can probably post more info.

ray


On Wed, 6 Jul 2005, Adam Melancon wrote:

> I have a small project that I'm working on in my spare time and it
> involves a big red button (picture the ones from arcade game cabinets)
> attached to the serial port.
> Now keep in mind, I'm no programmer, but I'm pretty good at bash scripts.
> Is there a simple way that I can have a bash script monitor the serial
> port for this button to be pressed and then trigger a function within
> the script.
>
> Basically what this will be is a linux box with a webcam and a mic and
> this button, and when the button is pressed, it will have ffmpeg
> capture 30 seconds of audio and video to an avi file and then wait for
> another press of the button.
> It would be ideal if somehow I could also have a red led go on during
> capture too.
>
> There is no real use that I have for this at the moment, it's just
> something I'm doing to see if it can be done.
>
> Does anyone have a simple solution to my serial port quandry?
>
> Thanks!
>
>
>

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Ray DeJean                                       http://www.r-a-y.org
Systems Engineer                    Southeastern Louisiana University
IBM Certified Specialist              AIX Administration, AIX Support
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Reply via email to