サイト内検索

検索

Shares

Table of Content

EthercatMaster.evtGetMasterState()

[Ethercat Master]

説明

EtherCATマスタの状態を示す ECAT_EVT_STATE_CHANGED イベントの内容を取得します。

構文

int evtGetMasterState();

媒介変数

なし

戻り値

EtherCATマスタの状態を返します。

備考

この関数は、 イベント・コールバック内で呼び出す必要があります。.

#include <Ethercat.h>

EthercatMaster master;
int CurrentMasterState;

void EventCallback(uint32_t eventcode)
{
  if (eventcode == ECAT_EVT_STATE_CHANGED)
    CurrentMasterState = master.evtGetMasterState();
}

void setup() {
  Serial.begin(115200);
  master.attachEventCallback(EventCallback);
  master.begin();
  master.start();
}

void loop() {
  Serial.print("CurrentMasterState: ");
  Serial.println(CurrentMasterState);
  delay(1000);
}

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

上部へスクロール