python - pyserial works in repl but not script -
i'm attempting write data arduino using pyserial on windows. however, i've run bit of snag can't seem figure out. can run:
>>> import serial >>> ser = serial.serial('com3',9600) >>> ser.write(b'0') and works fine on repl not when run in script. entirity of script text being:
import serial if __name__=="__main__": ser = serial.serial('com3',9600) print("yes, being called") ser.write(b'0') and has me baffled. has dealt this?
Comments
Post a Comment