Open a serial port
In order to send commands to the device, you first need to open a serial port.
Which port to open depends on the computer, operating system, and how the device is connected.
In the following examples, replace the placeholder port name, COM3, with name of your connection.
If you are uncertain about the name of your connection, see our guide to finding the right port.
with Connection.open_serial_port("COM3") as connection:
device_list = connection.detect_devices()
print("Found {} devices".format(len(device_list)))
# The rest of your program goes here (indented)
Run the code and you should see the number of detected devices in the output of the application.
If you encounter a problem during this step, check that the device is connected correctly and powered on.
Also ensure that other applications, such as Zaber Console, do not have the port open by either selecting Close or exiting the application.
If you encounter
DeviceAddressConflictException
, use the Zaber Launcher application to assign distinct addresses to your devices.
During the device identification, the library connects to the internet to retrieve information about Zaber devices. No personal or identifying information is exchanged with Zaber servers. The library stores all the information in the operating system cache folder to later allow for offline use. For more information about the behaviour see Device Database.
The example code demonstrates use of a with statement to ensure that the serial port closes after the program runs.
Continue the Getting Started guide by homing your device.