Pregunta

I'd like to connect with Lake Shore Temperature Controler M331 via RS232, and I've got a little problem with that. When i give a "command" it still waits for another one instead of sending it to my device. Here is my code:

import serial
    import time


port = serial.Serial(15)
    print "Opening serial port: " + port.name 
    out = []

    command = raw_input('Command: ')
    if command == 'exit':
        port.close()
        exit()
    else:
        port.write(command)
        time.sleep(1)
        out.append(port.read(8))

    if len(out) == 0:
        print ':('
    else:
        print out

    port.close()

What is wrong with my code?

¿Fue útil?

Solución

found it sorry for interrupting ;) there should be:

port.write(command +'\r')
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top