[Ethercat Device]
Description
Get the device name of the EtherCAT slave device.
Syntax
char *getDeviceName(char *name, size_t len);
Parameters
[out] char *name
The buffer used to store the device name.[in] size_t len
The size of the buffer used to store the device name.
Return Value
Return the pointer to the buffer used to store the device name. If the returned value is NULL
, it indicates an error.
Comment
This function must be called after a successful execution of EthercatMaster::begin()
. This function is non-blocking and can be called within the Cyclic Callback.
Example
#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() { // ... }
Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.