Universal Robots Forum

Python script comminucate with modbus

Hello,
I’m working now on a bachelor thesis project, and I’m a beginner in robotic programming. I wrote a python script on my PC and I want this program to give order to the robot to do some stuff with Modbus communication. For example

wait till read_port_register (128) == 1
do some stuff…
write_port_register (129,1)
wait till read_port_register (130) == 1
do some stuff…
write_port_register (131,1)

in the python script:

script.write_register(128,1)
print(‘move to point 1’)
while True:
if script.read_holding_registers(129)==1:
script.write_register(130,1)
print(‘move to point 2’)

In this way.
Thanks for your helps and have a nice day!