Skip to main content

Adapting I/O Devices

This example shows how to use the dobot-plus skill in an AI Agent to adapt external devices via controller I/O (DI/DO) or tool-end I/O (ToolDI/ToolDO). Instead of writing Lua, HTTP APIs, and UI pages by hand, the Skill generates plugin scaffolding from your I/O requirements in Requirements.md—you only need to prepare the document and invoke /dobot-plus in the IDE.

Example Workflow​

Environment Setup​

Confirm the following before development. See Development Environment for more detail.

DependencyVersion / Notes
Node.jsv20 or later
IDESupports Agent Skills (e.g. Cursor)
@dobot-plus/cliGlobal install; provides the dpt command
@dobot-plus/skillGlobal install; provides the /dobot-plus skill

Install:

npm install -g @dobot-plus/cli @dobot-plus/skill@latest

Verify:

node -v    # Should print v20.x or later
dpt -v # Confirm CLI works

After install, the Skill is deployed to ~/.agents/skills/dobot-plus. Enable Agent Skills in your IDE settings to use it.

Provide a Developer Manual​

Collect the device developer manual yourself and place the PDF in the user_manual folder at the project root.

user_manual

The developer manual should include the following:

CategoryDescription
Communication methodController DI/DO, or tool-end ToolDI/ToolDO (pick one; do not mix)
I/O portsPort number and direction (input/output) for each function
Level semanticsWhat high/low level means for each port
Status criteriaSuccess/failure conditions for read functions (e.g. DI-1 high = started)
Function semanticsEach atomic operation exposed externally (output control / status read)
Operation flowTypical start/stop/reset sequence (including wait and timeout guidance)

A user manual can contain multiple PDF files. The Agent Skill reads the contents of user_manual, consolidates the functions into a Requirements.md product requirements document, and then develops the plugin from that document. If the manual is missing required communication protocol or function descriptions, the Agent Skill stops.

Run the Skill​

Select Agent mode.

Agents

Invoke the /dobot-plus skill.

Requirements.md

Device Examples​

The examples below use controller DI/DO to interact with external devices: DO sends start/stop commands; DI reads device feedback. Run dpt create first, then write Requirements.md.

External device I/O control​

Create project:

dpt create

Example prompts:

$ dpt create
? Please input plugin name: io
? Please input plugin description: A plugin demo for external device IO control
? Please input plugin version: 1-0-0-test
? Please input device IP: 192.168.5.1

Then:

cd io
Full I/O control Requirements.md example
# I/O Control Example

> Send commands to an external device via controller digital outputs (DO) and read status via digital inputs (DI).

## 1. Device overview

This plugin controls an external processing device over controller I/O—no Modbus or TCP.

## 2. Communication method

| Item | Description |
| ------------ | ------------------------------------------------- |
| Protocol | Controller I/O |
| Output ports | DO (digital output) |
| Input ports | DI (digital input) |
| Lua API | `DO(index, ON\|OFF)`, `DI(index)`, `GetDO(index)` |

## 3. I/O ports

| Port | Direction | High level | Low level |
| ---- | --------- | -------------- | ------------------ |
| DO-1 | Output | Start command | Idle / not started |
| DO-2 | Output | Stop command | Idle / not stopped |
| DI-1 | Input | Device started | Device not started |
| DI-2 | Input | Device stopped | Device not stopped |

## 4. Functions

### 4.1 StartDevice — start external device

- Action: `DO(1, ON)` — high level on DO-1
- UI: button

### 4.2 GetStartStatus — read start status

- Action: read `DI(1)`
- Return: `1` if DI-1 is high (started); `0` if not ready or failed
- UI: read-only status

### 4.3 StopDevice — stop external device

- Action: `DO(2, ON)` — high level on DO-2
- UI: button

### 4.4 GetStopStatus — read stop status

- Action: read `DI(2)`
- Return: `1` if DI-2 is high (stopped); `0` if not ready or failed
- UI: read-only status

## 5. Operation flow

### Start

1. Call `StartDevice` — DO-1 high
2. Wait for device response (1–3 s recommended)
3. Call `GetStartStatus` — confirm DI-1 is high

### Stop

1. Call `StopDevice` — DO-2 high
2. Wait for device response (1–3 s recommended)
3. Call `GetStopStatus` — confirm DI-2 is high

## 6. Safety notes

- Confirm DO wiring before operation to avoid unintended device triggers
- After stop command, confirm safe shutdown via DI feedback
- If DI stays low, check external device fault or wiring

After generation, verify:

  • Communication method in Requirements.md is controller I/O (if using tool-end I/O, switch to ToolDI/ToolDO and update port descriptions)
  • DO/DI port numbers match on-site wiring
  • Each function describes a single operation

Tool-end I/O (ToolDI / ToolDO)​

If the device is wired to the robot tool end rather than the controller, set communication to tool-end I/O and use ToolDO / ToolDI in function descriptions. For manual implementation, see Basic IO example.

Using the Agent Skill​

Open the plugin project and run this slash command in IDE Chat:

/dobot-plus

skill demo

Import and use​

  1. Open DobotStudio Pro → Dobot+ plugin management
  2. Uninstall any existing plugin with the same name
  3. Import the zip from output/
  4. Use the plugin from the nav bar (UI, blocks, scripts)

Package name format:

<plugin-name>_v<major>-<minor>-<patch>-<status>.zip

See Quick Start — Build & Use for screenshots and details.

Example Plugin UI Screenshots​

io

FAQ​

Manual build when Agent packaging fails​

When development and debugging are complete, run from the project root:

dpt build

Output:

  • dist/ — built plugin source for inspection
  • output/ — zip package <plugin-name>-<version>.zip for import

Skill reports missing Requirements.md​

Ensure Requirements.md is in the project root with I/O port definitions and functions. The Skill will not create it for you.

No DI feedback after DO output​

  • Verify DI/DO wiring and port numbers in Requirements.md
  • Confirm external device is powered and ready
  • Some devices respond slowly—add a short wait before reading DI in Lua

Mixing controller and tool-end I/O​

Pick one method in Requirements.md. Controller: DI / DO. Tool-end: ToolDI / ToolDO—do not mix APIs in one function.

Poor Agent results​

  • Clarify port numbers and level meanings in Requirements.md
  • Ensure functions are split into atomic operations (one action per function)
  • Check the Agent model: use GPT-5.4 or newer in VS Code Copilot; Auto mode in Cursor generally works well