Hi!
I have been trying for some time to set up serial communication between my pc and my ABB YuMi robot.
I have created a simple RAPID program which sends a string out of COM1 and am trying to read this string and print it to terminal using python.
However, all I get is a loop of empty strings until I stop my programs.
Have anybody here got any tips or possible solutions?
I use a 9 pin to usb cabel connected to the XS10 PROFUBUS.
The RAPID code is:
MODULE TestSeriel
VAR iodev com1;
VAR string test_num := "7";
PROC main()
Open "COM1", com1 \Bin;
WHILE TRUE DO
ClearIOBuff com1;
WriteStrBin com1, test_num;
WaitTime 2;
ENDWHILE
ENDPROC
ENDMODULE
The Python script is:
from time import time, sleep
import serial
class SerialHandle():
def __init__(self, path = "COM5", baud = 9600):
self.ser = serial.Serial (port=path, baudrate=baud, timeout=2)
def read(self, encoding = "Ascii"):
return self.ser.read(8).decode(encoding)
def close_port(self):
self.ser.close()
A = SerialHandle(path = "COM9")
while True:
print([A.read()])
sleep(2)
A.close()
Cheers TSO
Edit: The emojies are note supposed to be there, they are just auto translated.