我无法获得NXT的名称

时间:2014-10-23 09:31:53

标签: c# nxt

我正在使用NXT和使用c#开发一个项目,我想确保首先将我的NXT与测试控制台程序连接起来。这是我的代码:

using System;
using System.Diagnostics;
using System.Threading;
using System.Linq;
using System.Text.RegularExpressions;
using NKH.MindSqualls;

namespace NxtTest
{
    class Program
    {
        static void Main(string[] args)
        {
            NxtBrick brick = new NxtBrick(NxtCommLinkType.USB, 0);
            NxtUsbConnection conn = new NxtUsbConnection();

            conn.Connect();

            NxtGetDeviceInfoReply? reply = conn.GetDeviceInfo();
            if (reply.HasValue)
                Console.WriteLine("Nxt name: {0}", reply.Value.nxtName);
            else
                Console.WriteLine("Nope");

            conn.Disconnect();
            Console.ReadLine();
        }
    }
}

我的控制台一直告诉我“不”。 我的代码受到http://www.mindsqualls.net/QuickStart_2_0.aspx

的启发

0 个答案:

没有答案