Search code examples
usbserial-porthardware-interface

Toggle pin from serial COM port via batch file


I'm attempting to use one of the pins from the serial port to toggle some outside hardware. I want to be able to call a batch file or something similar to be able to turn on/off the output of the pin. Is there a simple way to do this?

Ideally i'd like to be able to do this with a USB port as well but I'd image it will be harder to do. Is this the case is it easy to flip one pin on a usb port?

Cheers,

Mark


Solution

  • If you have a LPT (Line Printer Terminal) that would be your best bet. You would also be able to use a USB-2-LPT adapter. More options would be USB Digital I/O device. You will probably want something that uses either parallel output or has digital IO pins (such as this). Trying to use a serial port to control something external will require a UART device to convert the serial signal into the parallel bits.

    (Even more fun... Bluetooth to GPIO)

    Edit to make some happy...

    Yes you could control the hardware control pins for single bits of input/output with a serial port. As to the point about USB-LPT, that could be the case depending on the particular hardware or platform btu I have yet to run into it as an issue.