Skip to content

Get Actual Digital Input Bits

SUMMARY

Get Actual Digital Input Bits returns the state of all digital inputs as a packed integer bitmask. Each bit corresponds to a single digital input channel. Use bitwise operations to extract the state of individual channels.

Bit assignments: bits 0–7 are standard digital inputs, bits 8–15 are configurable digital inputs, and bits 16–17 are the two tool digital inputs.

SUPPORTED ROBOTS

This skill is currently supported on Universal Robots only. Calling this method on other robot brands will raise a NotImplementedError.

The Skill

python
bits = robot.get_actual_digital_input_bits()

The Code

Example: Read and Display All Digital Input States

Connect to the robot, read the digital input bitmask, and display it in binary.

python
from loguru import logger
from telekinesis.synapse.robots.manipulators import universal_robots

robot_ip = "192.168.1.2"  # replace with your robot's IP

robot = universal_robots.UniversalRobotsUR10E()
# Connect
robot.connect(ip=robot_ip)

bits = robot.get_actual_digital_input_bits()
logger.info(f"Digital input bits: {bits:#018b}")

# Check whether standard digital input 0 is high
di0 = bool(bits & (1 << 0))
logger.info(f"DI0: {di0}")

# Disconnect
robot.disconnect()

The Explanation of the Code

get_actual_digital_input_bits returns the full digital input state as a single integer bitmask. The bit at position n corresponds to digital input channel n. Use bits & (1 << n) to extract a specific channel, or bool(bits & (1 << n)) to get a boolean. Printing with {bits:#018b} shows the full 18-bit binary representation.

How to Tune the Parameters

This skill takes no parameters.

Return Value

TypeDescription
intBitmask of all digital input states. Bits 0–7: standard inputs; 8–15: configurable inputs; 16–17: tool inputs.

Where to Use the Skill

  • I/O monitoring — Read multiple digital input states in a single call without polling each channel individually
  • Event detection — Check for sensor signals, limit switches, or external triggers

When Not to Use the Skill

Do not use Get Actual Digital Input Bits when: