0
    using System;
    using Zaber.Motion;
    using Zaber.Motion.Ascii;
    namespace ZaberMotion
    {

    class Program
     {
    static Axis x_axis;
    static Device device1;
   
      public static void Main(string[] args)
      {
        Library.EnableDeviceDbStore();

        using (var connection = Connection.OpenSerialPort("COM3"))
        {
            var deviceList = connection.DetectDevices();
            Console.WriteLine($"Found {deviceList.Length} devices.");
            


            var speed = x_axis.Settings.Get("maxspeed",Units.Velocity_MillimetresPerSecond);

            Console.WriteLine("Maximum speed [mm/s]: {0}", speed);

            x_axis.Settings.Set("maxspeed", speed /9.0,Units.Velocity_MillimetresPerSecond);

            }
         }
       }
      }

我得到 var speed 的空值。简单的错误我不确定如何解决。有小费吗?设备初始化,一切顺利

4

1 回答 1

1

您需要先定义设备和轴,然后才能获取轴的设置。

后:

var deviceList = connection.DetectDevices();
Console.WriteLine($"Found {deviceList.Length} devices.");

包括:

device1 = deviceList[0];
x_axis = device1.GetAxis(1);

麦克麦克唐纳

扎伯科技

mike@zaber.com

于 2021-04-30T04:25:57.683 回答