Triggering from Serial port

Hello,

General purpose communication with serial devices using Python is usually done with the PySerial library.

https://pythonhosted.org/pyserial/

Something like this will write a byte to the port and read the response.

import serial

def main():
    # open the port
    port = serial.Serial("COM1", 9600)

    port.write('a')
    port.flush()

    while not port.inWaiting():
        print(port.readline())

    port.close()
    return 0

if __name__ == "__main__":
    main()