i'd execute script, passing arguments command line:
import serial import sys try: ser = serial.serial("com7", 9600) except serial.serialexception: print("exception...") if sys.argv[1] == "on": ser.write("m".encode('latin1')) print("light on...") elif sys.argv[1] == "off": ser.write("n".encode('latin1')) print("light off...") ser.close()
the serial device doesn't character sent through serial communication if script launched command line:
c:\users\user\desktop\seriale.py on
launching through python idle (removing sys.argv sure) works , serial device gets data should. wrong?
Comments
Post a Comment