# Digital input python script

**URL:** <https://forum.universal-robots.com/t/digital-input-python-script/26969>\
**Category:** Technical Questions\
**Created:** [February 22, 2023, 3:54pm UTC](https://forum.universal-robots.com/t/digital-input-python-script/26969 "2023-02-22T15:54:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![t.vanderwal](https://avatars.discourse-cdn.com/v4/letter/t/dfb087/32.png) [@t.vanderwal](https://forum.universal-robots.com/u/t.vanderwal)\
**Post date:** [February 22, 2023, 3:54pm UTC](https://forum.universal-robots.com/t/digital-input-python-script/26969/1 "2023-02-22T15:54:50Z")

</div>

Is there a way to get/catch a digital input signal from a URe3 in a python script? I have a socket tcp (ethernet) connection. On my cobot there are two buttons connected (start / stop) both give a digital input on the teach pendant. Get\_digital\_input doesn’t excists. Any ideas? I read something about a xml file…

---

<div class="post-metadata">

**Author:** ![pho](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/pho/32/2275_2.png) [@pho](https://forum.universal-robots.com/u/pho)\
**Post date:** [February 22, 2023, 5:34pm UTC](https://forum.universal-robots.com/t/digital-input-python-script/26969/2 "2023-02-22T17:34:00Z")

</div>

get\_standard\_digital\_in(n)

Get standard digital input signal level  
See also get\_configurable\_digital\_in and get\_tool\_digital\_in.  
Parameters n: The number (id) of the input, integer: [0:7]  
Return Value boolean, The signal level.  
Example command: get\_standard\_digital\_in(1)  
• Example Parameters:  
• n is standard digital input 1  
• Returns True or False

---

<div class="post-metadata">

**Author:** ![jdkowalski](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jdkowalski](https://forum.universal-robots.com/u/jdkowalski)\
**Post date:** [January 4, 2025, 2:07am UTC](https://forum.universal-robots.com/t/digital-input-python-script/26969/3 "2025-01-04T02:07:14Z")

</div>

Hello @pho ,  
I have a similar question to @t.vanderwal above – but for the tool’s digital input.

I am familiar with get\_tool\_digital\_in(n), and I can send a string via python: popup(get\_tool\_digital\_in(1)), and it properly prints a popup with the value on the pendant.

However, I am unaware of how to retrieve this data via TCPIP. I get an error when

In URBasic .py, I see the following:

def get\_tool\_digital\_in(self, n):  
‘’’  
Get tool digital input signal level

```
    See also get configurable digital in and
    get standard digital in.

    Parameters:
    n: The number (id) of the input, integer: [0:1]

    Return Value:
    boolean, The signal level.
    '''
    raise NotImplementedError('Function Not yet implemented')

```

Would it be easier to do this with the rtde package? Please advise.

I am told that pickstate = mySocket.recv(1024) can be used but I’d like something simpler than handling all of that data if I can help it.

Thank you!
