我想找...

搜尋

分享

目錄

EthercatDevice_Dmp.tryToGetPeripheralPowerCurrent()

[EthercatDevice_Dmp]

描述

Try to get the peripheral current in a non-blocking manner. If it returns true, the reading process is complete, and you must immediately call getPeripheralPowerCurrent() to get the value. Otherwise, it indicates that the process is not yet complete.

語法

bool tryToGetPeripheralPowerCurrent();

參數

回傳值

Return a boolean value indicating whether the non-blocking read process has completed.

  • true: Completed.
  • false: In progress.

備註

This function must be called after a successful execution of EthercatMaster::begin(). This function is non-blocking and can be called within the callback functions.

範例程式碼

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_QECR11DT0H slave;
double PeripheralCurrent;

void CyclicCallback() {
  if (slave.tryToGetPeripheralPowerCurrent())
    PeripheralCurrent = slave.getPeripheralPowerCurrent();
}

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

  master.begin();
  slave.attach(0, master);
  master.attachCyclicCallback(CyclicCallback);
  master.start();

}

void loop() {
  Serial.print("Peripheral Current: ");
  Serial.println(PeripheralCurrent);
  // ...
}

Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.

返回頂端