# Controlling External Hardware

**URL:** <https://forum.universal-robots.com/t/controlling-external-hardware/29554>\
**Category:** Technical Questions\
**Created:** [July 18, 2023, 4:03am UTC](https://forum.universal-robots.com/t/controlling-external-hardware/29554 "2023-07-18T04:03:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon47102137](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@anon47102137](https://forum.universal-robots.com/u/anon47102137)\
**Post date:** [July 18, 2023, 4:03am UTC](https://forum.universal-robots.com/t/controlling-external-hardware/29554/1 "2023-07-18T04:03:53Z")

</div>

Hello,

I am new to this topic and I am working on a project controlling a prosthetic hand attached to an e-series cobot. There will be an external computer to manage everything because the cobot doesn’t have enough IO ports, and the cobot must communicate its position/velocity/other data.

I am seeking help/guidance on the following:

- I have made a simple URCap following this tutorial from universal robots [https://www.universal-robots.com/articles/ur/urplus-resources/urcap-my-first-urcap/](https://www.universal-robots.com/articles/ur/urplus-resources/urcap-my-first-urcap/) to model a 2 fingered gripper with 2 degrees of freedom each, and I was wondering what urscript functions I should use to control the speed/position of a brushless DC motor that would be plugged into the external computer. Below is the current code I have where the urscript is added and it models the step in the tutorial titled “Creating the Contribution”:  
public void generateScript(ScriptWriter writer) {  
writer.appendLine(“set\_standard\_digital\_out(”+getDOF()+“, True)”);  
writer.sleep(getDuration());  
writer.appendLine(“set\_standard\_digital\_out(”+getDOF()+“, False)”);  
}

I don’t think the function “set\_standard\_digital\_out” has the capability to to control the speed/position of a brushless DC motor. Are there any functions here that I should use?

- What protocol is recommended for communicating between the computer and cobot?  
I think this can be done with TCP/IP and RTDE, but I am not sure what is best for this scenario, how they work, or how to implement them.

I appreciate any help

---

<div class="post-metadata">

**Author:** ![m.hammerton](https://avatars.discourse-cdn.com/v4/letter/m/b2d939/32.png) [@m.hammerton](https://forum.universal-robots.com/u/m.hammerton)\
**Post date:** [July 18, 2023, 7:32am UTC](https://forum.universal-robots.com/t/controlling-external-hardware/29554/2 "2023-07-18T07:32:55Z")

</div>

I think RTDE is the best way for you to comunicate with an external PC see [Real-Time Data Exchange (RTDE) Guide - 22229](https://www.universal-robots.com/articles/ur/interface-communication/real-time-data-exchange-rtde-guide/)

Using this you can set and read Boolean, Real and Integer registers to give you the flexibility you need for speed control.
