xarm_set_cgpio_digital

1. Introduction

Set Controller Digital Output to low/high level.

Button: [Blockly]- [Controller IO]-Set CO

2. Request & Response

```
{
    "cmd": "xarm_set_cgpio_digital",
    "data": {
        "ionum": 0,
        "value": 1,
        "delay": 0
    },
    "id": "1"
}
```

3. Code Example

background

GLOBAL.XArm.xarm_printed = True
ret = yield self._wait_until_cmdnum_lt_max()
if ret is not None:
    return response(client, cmd_id, ret)
ionum = data.get('ionum')
value = int(data.get('value'))
xyz = data.get('xyz')
tol_r = data.get('tol_r')
code = GLOBAL.XArm.xarm.set_cgpio_digital_with_xyz(ionum, value, xyz, tol_r)
response(client, cmd_id, code)

front_end

self.set_cgpio_digital = async (ionum, value, callback, delay) => {
  const params = window.GlobalConstant.INIT_CMD_PARAMS_COMMON_DATA();
  Object.assign(params.data, {
    ionum: ionum,
    value: value,
    delay: (delay !== undefined && delay > 0) ? delay : 0
  });
  console.log('set_cgpio_digital params', params);
  const cmd_id = self.sendCmd(window.GlobalConstant.SET_CGPIO_DIGITAL, params, (dict) => {
    self.codeHandle(dict, 'set cgpio digital', true);
    if (callback) {
      callback(dict);
    }
  });
  await self.socketCom.wait(cmd_id);
};

Last updated