Hi All,
I am relatively new to the ConnectPort family of Gateways. I am testing some code which will eventually parse serial data inbound from a wireless module. For now, however, I want the source of the serial data to be the serial port on the side of the ConnectPortX4 gateway. I have tried to follow instruction at various locations on this site to no avail. Using this simple program below. I expected 500 iterations of the string “XYZ” to appear in the serial terminal program main window which I have monitoring the ConnectPort X4 serial port. I configured, via web interface, the serial port to be “Real Port” with no actual real port host connected to it in hopes that the python functionality can acess it.
Please help…thanks in advance.
import os, sys
i = 0
try:
serfd = os.open(‘/com/1’, os.O_RDWR | os.O_NONBLOCK);
#print ‘termios =’, termios.tcgetattr(self.fd)
# write out a constant string...
while (i < 500):
os.write(serfd, "XYZ")
i = i + 1
except:
print “failed to open serial port”
os.close(serfd)