[EthercatDevice_Dmp]
説明
非ブロッキング方式でシステム電流を取得しようとします。戻り値が true の場合、読み取りプロセスは完了しており、値を取得するにはすぐに getSystemPowerCurrent()
を呼び出す必要があります。そうでない場合は、プロセスがまだ完了していないことを示します。
構文
bool tryToGetSystemPowerCurrent();
媒介変数
なし
戻り値
非ブロッキング読み取りプロセスが完了したことを示すブール値を返します。
- true: 完了しました。
- false: 処理中です。
備考
この関数は、 EthercatMaster::begin()
の前に呼び出す必要があります。この関数はブロッキングされていないため、コールバック関数内で呼び出すことができます。
例
#include "Ethercat.h" EthercatMaster master; EthercatDevice_QECR11DT0H slave; double SystemCurrent; void CyclicCallback() { if (slave.tryToGetSystemPowerCurrent()) SystemCurrent = slave.getSystemPowerCurrent(); } void setup() { Serial.begin(115200); master.begin(); slave.attach(0, master); master.attachCyclicCallback(CyclicCallback); master.start(); } void loop() { Serial.print("System Current: "); Serial.println(SystemCurrent); // ... }
詳細は EtherCAT Library User Manual QEC EtherCAT命令とAPI使用法参照