[Ethercat Master]
Description
Get EtherCAT Slave Count Number on EtherCAT bus.
Syntax
uint16_t getSlaveCount();
Return Value
Return the number of slaves on the network. If an error occurs, it will return 0.
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; void setup() { uint16_t slavecount, i; Serial.begin(115200); master.begin(); slavecount = master.getSlaveCount(); for (i = 0; i < slavecount; i++) { Serial.print("Slave"); Serial.print(i); } } void loop() { // ... }
Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.