xarm_set_gpio_digital

1. Introduction

Set tool digital output.

Button: [Blockly] - [Tool IO] - Set

2. Request & Response

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

3. Code Example

background

yield self._wait_until_not_pause()
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 = data.get('value')
delay = data.get('delay', 0)
code = GLOBAL.XArm.xarm.set_tgpio_digital(ionum, value, delay_sec=delay)
response(client, cmd_id, code)

front_end

self.set_gpio_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
  });
  const cmd_id = self.sendCmd(window.GlobalConstant.SET_GPIO_DIGITAL, params, (dict) => {
    self.codeHandle(dict, 'set tgpio digital', true);
    if (callback) {
      callback(dict);
    }
  });
  await self.socketCom.wait(cmd_id);
};

Last updated