ArduinoUploader NuGet package

0

I have downloaded the NuGet package Arduino Uploader (https://www.nuget.org/packages/ArduinoUploader/), and receive the following error when trying to run it using the example on the github page (https://github.com/twinearthsoftware/ArduinoSketchUploader) under the .Net package. The code is as follows

var upload = new ArduinoSketchUploader(
new ArduinoSketchUploaderOptions()
{ 
    FileName = @"location of the file",
    PortName = "COM7",
    ArduinoModel = ArduinoModel.Micro
});

upload.UploadSketch();

The error of Exception unhandled occurs on the upload.UploadSketch(); line giving off

ArduinoUploader.ArduinoUploaderException: 'Exception during close of the programmer: 'Object reference not set to an instance of an object.'.'`.

The details copied from Visual Studio are `ArduinoUploader.ArduinoUploaderException
  HResult=0x80131500
  Message=Exception during close of the programmer: 'Object reference not set to an instance of an object.'.
  Source=ArduinoUploader
  StackTrace:
   at ArduinoUploader.BootloaderProgrammers.Protocols.AVR109.Avr109BootloaderProgrammer.Close()
   at ArduinoUploader.ArduinoSketchUploader.UploadSketch(IEnumerable`1 hexFileContents)
   at ArduinoUploader.ArduinoSketchUploader.UploadSketch()
   at arduino_sending_code.Program.Main(String[] args) in C:\Users\User\source\repos\arduino sending code\arduino sending code\Program.cs:line 39

  This exception was originally thrown at this call stack:
    [External Code]
    arduino_sending_code.Program.Main(string[]) in Program.cs

Are there any suggestions to overcome this error?

c#
visual-studio-code
arduino
nuget-package
asked on Stack Overflow Jun 5, 2020 by Tom m • edited Jun 5, 2020 by anilcemsimsek

1 Answer

0

The error you recieved is due to a dodgy hex file. You need to find the hex file from temp folder on your computer where the computer places them. Thats the only file which works. Also later on you might face an issue with another error, make sure you have the right programmer on the arduino, the details are avilable under the bootloader column on the ArduinoUploader github page.

answered on Stack Overflow Jun 23, 2020 by TotallyNotOP

User contributions licensed under CC BY-SA 3.0