hi - I need to open a serial port in 9600 and send a command followed by closing it, open serial port again and send a second command at 115200. I have both commands working separately from the python command line but it won't work in the script. Any idea why?
import serial from time import sleep ser = serial.Serial(0, baudrate=9600) status = ser.isOpen() print "baud bitch:" ser.isOpen() #init to TIPY ser.write('\x00\x00\x00\x00\xE0\xE0\xE0\xE0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x13\x00\x02\x00\xEB\xFD\xFF \x10\x87\x02\xFE\x10\x03\x10\x87\x02\xFE\x10\x03') #hex command msg ser.close() sleep(5) #wait ser = serial.Serial(0, baudrate=115200) ser.baudrate ser.write('\x10\x1C\x0D\x02\x0B\x0B\x02\x01\x21\x06\x00\x13\x07\x18\x7F \x10\x03') ser.close() #import os #program = 'C:\Program Files\Program.exe'+'-start' #os.system(r'program) -- http://mail.python.org/mailman/listinfo/python-list