I need to program the computer for him to write some words every 10 seconds in tera term terminal.
For exemple, I need him to write for exemple
Abc+enter key, def+enter key, ghi+enter key, klmn+enter key. etc....(in loop)
IN the terminal, I would like it to be written this way
importosimport serial
importtime
fcmd =open("Commands.txt")commands= fcmd.read().split("\n")[:-1]
cmd_len =len(commands)# Serial Port open
ser = serial.Serial('COM3',38400,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS)time.sleep(2)
i=0while(1):
cmd=commands[i]
i =(i+1) % cmd_len
print(cmd)
ser.write("%s\n"%cmd)time.sleep(10)
ser.close()
I am using windows 10 and downloaded python 3.6.2 shell
When I type import serial from the python, I get this error
Code:
>>> import serial
Traceback (most recent call last):
File "<pyshell#12>", line 1, in <module>
import serial
ModuleNotFoundError: No module named 'serial'
and when I type fcmd = open("Commands.txt")
I get this one
Code:
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape