Hi All,
I am very new to Monobrick. I have been trying to connect to ev3 via usb without any success. I am testing this on OSX 10.9 running on Xamarin Studio 4.2.1. I also added monobrick.dll, LibUsbDotNet.dll to the references:
I also copied all of the files from Monobrick to the bin/debug folder.
I have been trying to get this to work in the last week. Finally I am resourcing to this forum for help.
Thank you if anyone can point out what I am missing to get the USB connection to work.
This is my sample program:
using System;
using MonoBrick.EV3;
namespace ev3
{
class MainClass
{
public static void Main (string[] args)
{
var ev3 = new Brick<Sensor,Sensor,Sensor,Sensor>(“usb”);
try{
ev3.Connection.Open();
ev3.MotorA.On(50);
System.Threading.Thread.Sleep(3000);
ev3.MotorA.Off();
}
catch(Exception e){
Console.WriteLine(e.StackTrace);
Console.WriteLine(“Error: ” + e.Message);
Console.WriteLine(“Press any key to end…”);
Console.ReadKey();
}
finally{
ev3.Connection.Close();
}
}
}
}
Below is the terminal print out error:
at MonoBrick.HidLib`2[MonoBrick.EV3.Command,MonoBrick.EV3.Reply].Open () [0x00000] in <filename unknown>:0
at MonoBrick.USB`2[MonoBrick.EV3.Command,MonoBrick.EV3.Reply].Open () [0x00000] in <filename unknown>:0
at ev3.MainClass.Main (System.String[] args) [0x00013] in /Users/Thai/Desktop/EV3/EV3/Program.cs:15
Error: Failed to open connection
Press any key to end…
Press any key to continue…
Follow