1
votes

I'm attempting to use ArduinoDriver (through NU-Get) to connect to my Arduino Uno R3 in Visual Studio (in C#). This is the code I'm attempting to run:

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!");
    }
  }
}

The code compiles correctly. However I'm getting an exception at runtime on line 18 (the new Driver Instantiation) in the form of:

System.MissingMethodException: 'Method not found: 'Void ArduinoUploader.ArduinoSketchUploader..ctor(ArduinoUploader.ArduinoSketchUploaderOptions)'.'

I have checked and double-checked the package and dependencies and they are all installed and up to date.

I have also tried both false and true for the AutoBootstrap option in the Arduino Driver Constructor. When it is set to true, the results are as above. When set to false I receive the following exception instead:

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).'

I should also point out that I have checked the port for the Arduino and it is definitely connected to COM3 (tested and working in the Arduino I.D.E).

Finally on running the script in Visual Studio, the Arduino flashes its lights in the way that it normally would when a successful upload is in progress. However it hangs for a couple of seconds at the driver instantiation and then puts out the exceptions.

If anyone out there can shed some light on this that would be amazing, I have googled like crazy and have not found any tutorials or other people dealing with this issue. Please let me know if any further info is required.

Cheers!

Using Windows 10 Bootcamped (Mac)

2

2 Answers

2
votes

I got the same MissingMethodExeption. I synchronized the packages ArduinoDriver and ArduinoUploader (i.e. in my case downgrading the ArduinoUploader form v3.0.0 to v2.4.5) using the NuGet package manager.

This solved the issue for now...

0
votes

I copped a tumbleweed badge on this one, so I think I have discovered my own answer; which is to use visual micro, and never speak of Arduino Driver again.
cheers!