How can I do it with serial (USB to COM, RS232) and parallel (LPT) communication ? What kind of communication is prefer ?

Whichever you prefer from a programming perspective.

With a (true) "RS232" you could use eg. DSR (Data Set Ready) or, if implemented, RI (Ring Indicator).

With a LPT (SPP) port, the paper sensor would be a good choice, or it could be set to interrupt on one of the pins (don't remember which, it's been a long time since I programmed for the LPT).

If you have a physical printer port and a DLL to communicate with it, it will probably be the easiest way to go.On old PCs with a game port, this is the absolute best for such stuff.

Personally, I'd just make a circuit flashing an LED or buzzing a piezo-bleeper and mount it near the PC, if that's where you want it and if the purpose is just checking the door, since there's no overhead then and less to go wrong.

Logged

Regards,Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?Please remember...Engineering is based on numbers - not adjectives