`controller` is a built-in global object for reading basic controller state and sending basic controller commands.
It is used directly by name. Do not call `controller()`.
Controller commands affect the connected machine controller. Use them only in scripts where that behavior is intentional.
`controller` is a predefined global object. It is not created with a constructor.
| Item | Description |
|---|---|
| Syntax | `controller` |
| Arguments | not applicable |
| Returns | controller object |
print(controller.name);
Properties are read-only snapshots of current controller state.
| Property | Type | Description |
|---|---|---|
| `is_connected` | boolean | `true` when the host has an active controller connection. |
| `serial` | number | Current controller serial number. |
| `version` | number | Current main controller firmware version. |
| `name` | string | Current controller device kind/name. |
| `e_stop` | boolean | `true` when controller E-stop state is active. |
Example:
print('controller: ', controller.name); print('serial: ', controller.serial); print('version: ', controller.version); print('connected: ', controller.is_connected); print('e-stop: ', controller.e_stop);
Returns a display string for the object.
| Item | Description |
|---|---|
| Syntax | `value.to_string()` |
| Arguments | none |
| Returns | string |
Example:
text = value.to_string();
`clone()` is not supported for `controller`.
Sends a reset command to the controller.
| Item | Description |
|---|---|
| Syntax | `controller.reset()` |
| Arguments | none |
| Returns | result value |
The returned result indicates whether the host accepted and sent the command successfully.
result = controller.reset(); print(result);
Requests controller E-stop.
| Item | Description |
|---|---|
| Syntax | `controller.e_stop()` |
| Arguments | none |
| Returns | result value |
This command activates E-stop. It is not a replacement for physical safety wiring or operator safety procedures.
result = controller.e_stop(); print(result);
`controller` is a protected built-in global name. The name itself cannot be overwritten.
controller = 1; // error
Use `controller` methods to request controller actions.