Hi there!
I'm pretty new to python. I'm a chemist by training. Right now i'm sitting in the lab and try to understand how a certain serial connection is working. Everything makes sense to me in the code below, except for the \r part inside the go() function. The device is a port-selector, where you can select different ports (1-24). In the code port 7 is selected.
Without the \r the device is not working. Could anyone explain to me what the role of \r is and why \n couldn't be used?
Many thanks!
I'm pretty new to python. I'm a chemist by training. Right now i'm sitting in the lab and try to understand how a certain serial connection is working. Everything makes sense to me in the code below, except for the \r part inside the go() function. The device is a port-selector, where you can select different ports (1-24). In the code port 7 is selected.
Without the \r the device is not working. Could anyone explain to me what the role of \r is and why \n couldn't be used?
Many thanks!
import serial pos = 7 def go(): position = 'GO%d\r' % (pos) ps.write(position.encode()) pscom = "/dev/cu.usbserial-DO028VY0" ps = serial.Serial(port=pscom, baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS) go()