Home→Forums→MonoBrick Communication Library→Setting up→Reply To: Setting up
April 17, 2014 at 00:37
#4170
Antonio Prieto
Participant
Hi Anders,
I am getting a “Failed to open connection” error when trying to execute my first simple program. The program is very simple, the first example from the guide. Literally, I get this error:
en MonoBrick.WiFiConnection
2.Open()
en Program.Main(String[] args)
Error: Failed to open connection
Press any key yo end….`
The ev3 brick is connected to wifi and I have established a tcp/ip connection with the brick.
Compiling the program I get an .exe program, that I execute in the windows virtual machine, as I am using a mac.
<strong>So, what problem may I have with the program?</strong>
The program is:
using System;
using MonoBrick.EV3;
public static class Program{
static void Main(string[] args)
{
var ev3 = new Brick<Sensor,Sensor,Sensor,Sensor>("wifi");
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();
}
}
}
Follow