サイト内検索

検索

Shares

Table of Content

EthercatDevice.getDeviceName()

[Ethercat Device]

説明

EtherCATスレーブデバイスのデバイス名を取得します。

構文

char *getDeviceName(char *name, size_t len);

媒介変数

  • [out] char *name
    デバイス名を格納するために使用されるバッファ。
  • [in] size_t len
    デバイス名を格納するために使用されるバッファのサイズ。

戻り値

デバイス名を格納するために使用されるバッファへのポインタを返します。返された値が NULLの場合、 error code を示します。.

備考

この関数は、 EthercatMaster::begin()が正常に実行された後に呼び出す必要があります。この関数はブロッキングされていないため、循環コールバック内で呼び出すことができます。

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_Generic slave;

void setup() {
  Serial.begin(115200);

  master.begin();
  slave.attach(0, master);
  char name[64];
  Serial.println(slave.getDeviceName(name, 64));
}

void loop() {

  // ...
}

詳細は EtherCAT Library User Manual QEC EtherCAT命令とAPI使用法参照

上部へスクロール