Skip to content

Initialize

After installing the library, include the library at the top of your code:

from zaber_motion import Library
from zaber_motion.ascii import Connection

Library.enable_device_db_store()

# The rest of your program goes here
using Zaber.Motion;
using Zaber.Motion.Ascii;

// namespace name may differ in your code
namespace example
{
    class Program
    {
        static void Main(string[] args)
        {
            Library.EnableDeviceDbStore();

            // The rest of your program goes here
        }
    }
}
const { ascii: { Connection }, Library } = require('@zaber/motion');

async function main() {
  Library.enableDeviceDbStore();

  // The rest of your program goes here
}

main();
// package name may differ in your code
package example;

import zaber.motion.Library;
import zaber.motion.ascii.Axis;
import zaber.motion.ascii.Connection;
import zaber.motion.ascii.Device;

public class App
{
    public static void main(String[] args)
    {
        Library.enableDeviceDbStore();

        // The rest of your program goes here
    }
}
import zaber.motion.Library;
import zaber.motion.ascii.Connection;

Library.enableDeviceDbStore();

% The rest of your program goes here
javaaddpath("motion-library-jar-with-dependencies.jar");

CONNECTION_CLASS = "zaber.motion.ascii.Connection";
LIBRARY_CLASS = "zaber.motion.Library";

javaMethod("enableDeviceDbStore", LIBRARY_CLASS);

% The rest of your program goes here
#include <zaber/motion/ascii.h>

using namespace zaber::motion;
using namespace zaber::motion::ascii;

int main() {
    Library::enableDeviceDbStore();

    /* The rest of your program goes here */

    return 0;
}

The library connects to the internet to retrieve information about Zaber devices. Calling the method @method EnableDeviceDbStore makes the library store the downloaded information to later allow for offline use. For more information about the behaviour see Device Database.

Ensure that the file motion-library-jar-with-dependencies.jar is in the current directory. You can alternatively provide an absolute path.

Continue the Getting Started guide by opening a serial port.

Troubleshooting

If your compilation fails in Microsoft Visual Studio, it may be due to a conflict between macros in the WinAPI C headers and the C++ headers of the library. To resolve the conflict, undefine the colliding macros before including the library.

#undef ERROR
#undef min
#include <zaber/motion/ascii.h>

This is a known issue that may be resolved in a major version update.