Zaber devices can connect to each other in series
(also referred to as daisy-chaining).
This arrangement allows control of multiple devices through one serial port using a single
Connection
class instance.
The example below demonstrates how to home all axes of all devices on a port.
Python
C#
C++
JavaScript
MATLAB
Java
MATLAB (legacy)
# connection is previously opened Connection
device_list = connection.detect_devices()
print("Found {} devices".format(len(device_list)))
for device in device_list:
print("Homing all axes of device with address {}.".format(device.device_address))
device.all_axes.home()
// connection is previously opened Connectionvar deviceList = connection.DetectDevices();
Console.WriteLine($"Found {deviceList.Length} devices.");
foreach (var device in deviceList)
{
Console.WriteLine($"Homing all axes of device with address {device.DeviceAddress}.");
device.AllAxes.Home();
}
// connection is previously opened Connectionconst deviceList = await connection.detectDevices();
console.log(`Found ${deviceList.length} devices.`);
for (const device of deviceList) {
console.log(`Homing all axes of device with address ${device.deviceAddress}.`);
await device.allAxes.home();
}
// connection is previously opened Connection
Device[] deviceList = connection.detectDevices();
System.out.println(String.format("Found %d devices.", deviceList.length));
for (Device device : deviceList) {
System.out.println(String.format("Homing all axes of device with address %d.", device.getDeviceAddress()));
device.getAllAxes().home();
}
% connection is previously opened Connection
deviceList = connection.detectDevices();
fprintf('Found %d devices.\n', deviceList.length);
fori = 1:length(deviceList)
device = deviceList(i);
fprintf('Homing all axes of device with address %d.\n', device.getDeviceAddress());
device.getAllAxes().home();
end
% connection is previously opened Connection
deviceList = connection.detectDevices();
fprintf('Found %d devices.\n', length(deviceList));
fori = 1:length(deviceList)
device = deviceList(i);
fprintf('Homing all axes of device with address %d.\n', device.DeviceAddress);
device.AllAxes.home();
end
// connection is previously opened Connection
std::vector<Device> deviceList = connection.detectDevices();
std::cout << "Found " << deviceList.size() << " devices" std::endl;
for (auto& device: deviceList) {
std::cout << "Homing all axes of device with address " << device.getDeviceAddress() << "." << std::endl;
device.getAllAxes().home();
}
The
detect_devices
method returns devices ordered by their assigned address.
Check or change the addresses assigned to your devices in the Zaber Launcher application.
Device address conflict
If you connect multiple devices in series for the first time,
you may encounter a
DeviceAddressConflictException
exception when running this program.
This exception is thrown when multiple devices have the same address.
Use the Zaber Launcher application to assign distinct addresses to your devices.