Arduino 驱动程序问题(导致异常)
Arduino driver issues (Causing exceptions)
我正在尝试使用 ArduinoDriver(通过 NU-Get)在 Visual Studio(在 C# 中)中连接到我的 Arduino Uno R3。这是我尝试 运行:
的代码
using ArduinoUploader;
using ArduinoUploader.Hardware;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ArduinoDriver.SerialProtocol;
using System.Threading;
using ArduinoDriver;
namespace ConsoleApp2 {
class Program {
static void Main(string[] args) {
var driver = new ArduinoDriver.ArduinoDriver(ArduinoModel.UnoR3, "COM3", true);
driver.Send(new DigitalWriteRequest(13, ArduinoDriver.DigitalValue.Low));
driver.Send(new DigitalWriteRequest(13, ArduinoDriver.DigitalValue.High));
Console.WriteLine("doing it!");
}
}
}
代码编译正确。但是,我在第 18 行(新驱动程序实例化)的 运行 时间收到异常,形式为:
System.MissingMethodException: 'Method not found: 'Void ArduinoUploader.ArduinoSketchUploader..ctor(ArduinoUploader.ArduinoSketchUploaderOptions)'.'
我已经检查并仔细检查了软件包和依赖项,它们都已安装并且是最新的。
我还在 Arduino Driver Constructor 中尝试了 AutoBootstrap 选项的 false 和 true。当设置为true时,结果如上。当设置为 false 时,我收到以下异常:
System.IO.IOException: 'Unable to get a handshake ACK when sending a handshake request to the Arduino on port COM3. Pass 'true' for optional parameter autoBootStrap in one of the ArduinoDriver constructors to automatically configure the Arduino (please note: this will overwrite the existing sketch on the Arduino).'
我还应该指出,我已经检查了 Arduino 的端口,它肯定连接到 COM3(在 Arduino I.D.E 中测试和工作)。
最后,在 运行 执行 Visual Studio 中的脚本时,Arduino 以正常上传成功时的方式闪烁其灯。然而,它在驱动程序实例化时挂起几秒钟,然后抛出异常。
如果有人能阐明这一点那就太棒了,我疯狂地用谷歌搜索但没有找到任何教程或其他人处理这个问题。如果需要任何进一步的信息,请告诉我。
干杯!
使用 Windows 10 训练营 (Mac)
我在这个上贴了一个风滚草徽章,所以我想我找到了自己的答案;也就是用visual micro,再也不说Arduino Driver
干杯!
我得到了相同的 MissingMethodExeption。我使用 NuGet 包管理器同步了包 ArduinoDriver 和 ArduinoUploader(即在我的例子中,将 ArduinoUploader 从 v3.0.0 降级到 v2.4.5)。
这暂时解决了问题...
我正在尝试使用 ArduinoDriver(通过 NU-Get)在 Visual Studio(在 C# 中)中连接到我的 Arduino Uno R3。这是我尝试 运行:
的代码using ArduinoUploader;
using ArduinoUploader.Hardware;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ArduinoDriver.SerialProtocol;
using System.Threading;
using ArduinoDriver;
namespace ConsoleApp2 {
class Program {
static void Main(string[] args) {
var driver = new ArduinoDriver.ArduinoDriver(ArduinoModel.UnoR3, "COM3", true);
driver.Send(new DigitalWriteRequest(13, ArduinoDriver.DigitalValue.Low));
driver.Send(new DigitalWriteRequest(13, ArduinoDriver.DigitalValue.High));
Console.WriteLine("doing it!");
}
}
}
代码编译正确。但是,我在第 18 行(新驱动程序实例化)的 运行 时间收到异常,形式为:
System.MissingMethodException: 'Method not found: 'Void ArduinoUploader.ArduinoSketchUploader..ctor(ArduinoUploader.ArduinoSketchUploaderOptions)'.'
我已经检查并仔细检查了软件包和依赖项,它们都已安装并且是最新的。
我还在 Arduino Driver Constructor 中尝试了 AutoBootstrap 选项的 false 和 true。当设置为true时,结果如上。当设置为 false 时,我收到以下异常:
System.IO.IOException: 'Unable to get a handshake ACK when sending a handshake request to the Arduino on port COM3. Pass 'true' for optional parameter autoBootStrap in one of the ArduinoDriver constructors to automatically configure the Arduino (please note: this will overwrite the existing sketch on the Arduino).'
我还应该指出,我已经检查了 Arduino 的端口,它肯定连接到 COM3(在 Arduino I.D.E 中测试和工作)。
最后,在 运行 执行 Visual Studio 中的脚本时,Arduino 以正常上传成功时的方式闪烁其灯。然而,它在驱动程序实例化时挂起几秒钟,然后抛出异常。
如果有人能阐明这一点那就太棒了,我疯狂地用谷歌搜索但没有找到任何教程或其他人处理这个问题。如果需要任何进一步的信息,请告诉我。
干杯!
使用 Windows 10 训练营 (Mac)
我在这个上贴了一个风滚草徽章,所以我想我找到了自己的答案;也就是用visual micro,再也不说Arduino Driver
干杯!
我得到了相同的 MissingMethodExeption。我使用 NuGet 包管理器同步了包 ArduinoDriver 和 ArduinoUploader(即在我的例子中,将 ArduinoUploader 从 v3.0.0 降级到 v2.4.5)。
这暂时解决了问题...