[EthercatDevice_DmpStepper_Generic]
描述
Initialize the EthercatDevice_CiA402 object for the specified motor with the given identifier on the EtherCAT slave device and return a pointer to the initialized EthercatDevice_CiA402 object.
衍生類別:
| Class Name | Vendor ID | Product Code |
| EthercatDevice_QECR11MP3S | 0x00000bc3 | 0x0086d0d6 |
| EthercatDevice_QECR00MP3S | 0x00000bc3 | 0x0086d0d9 |
語法
EthercatDevice_CiA402 *cia402GetServo(int motor, EthercatDevice_CiA402 *servo = NULL);
參數
[in] int motor
The specified motor number on the EtherCAT slave device:- 1: Motor 1.
- 2: Motor 2.
- 3: Motor 3.
[in] EthercatDevice_CiA402 *servo
The pointer to an object of the EthercatDevice_CiA402 class declared by the user. If this parameter is NULL, initialize it with an object of the EthercatDevice_CiA402 class from the library and return a pointer to that object. Otherwise, initialize it with a pointer to an object of the EthercatDevice_CiA402 class provided by the user and return that pointer.
回傳值
Return an object pointer of the EthercatDevice_CiA402 class.
備註
This function must be called after a successful execution of EthercatMaster::begin(). This function only works in CiA 402 on the EtherCAT slave device. For more details, please refer to configDeviceMode().
WARNING: Prohibited from being called within the callback functions.
範例
#include "Ethercat.h"
EthercatMaster master;
EthercatDevice_QECR11MP3S slave;
EthercatDevice_CiA402 motor1;
EthercatDevice_CiA402 motor2;
EthercatDevice_CiA402 *pMotor[3];
void setup() {
master.begin();
slave.attach(0, master);
pMotor[0] = slave.cia402GetServo(1, &motor1);
pMotor[1] = slave.cia402GetServo(2, &motor2);
pMotor[2] = slave.cia402GetServo(3);
}
void loop() {
// ...
}Please see EthercatDevice_DmpStepper_Generic 類別 for more QEC Stepper Drivers instructions and API usage.