Home / Programming / C# / Stay Sharp: Monobrick for the EV3

Stay Sharp: Monobrick for the EV3

monobrick
If you’re a fan of C#, then you will love Monobrick, a communication library that works with the EV3.  It uses the EV3’s direct commands to remote control the brick.  It works with both the NXT and the EV3.  You can simply import the library into your project and start hacking away.

A simple example:

using System; 
using MonoBrick.EV3;

public static class Program{ 
  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(); 
    } 
  } 
}

Monobrick sports the following features:

  • Communicates with the brick using USB, Bluetooth, WiFi or a tunnel connection
  • Works with Linux, Mac OS, Windows, Windows Phone and Android
  • Support for all LEGO sensors that comes with the Retail and Educational sets
  • Support for a wide range of Hitechnic sensors (not yet supported on the EV3)
  • Control the motors individual or as a vehicle
  • Use the mailbox system to send messages/data to the brick
  • Play tones and sound files
  • Use the file system to download and upload files
  • Start and stop on-brick programs
  • Use exceptions to catch sensor and communication errors
  • Open and close connections with multiple bricks
  • and more..

You can use a variety of development environments to play with this.  My preference would go out to Visual Studio, but you can also use MonoDevelop/Xamarin Studio, if you’d like.  It works on Windows, Linux and OSX.

Awesome work, Anders!  You can find the official page here: [LINK], which also has links to documentation and more examples.

About Xander

Xander Soldaat is a Software Engineer and former Infrastructure Architect. He loves building and programming robots. He recently had the opportunity to turn his robotics hobby into his profession and has started working for Robomatter, the makers of ROBOTC and Robot Virtual Words.
uijquery.org | 521: Web server is down

Error 521 Ray ID: 20d7d6263e5b264d • 2015-07-29 09:35:56 UTC

Web server is down

You

Browser

Working
Dallas

CloudFlare

Working
uijquery.org

Host

Error

What happened?

The web server is not returning a connection. As a result, the web page is not displaying.

What can I do?

If you are a visitor of this website:

Please try again in a few minutes.

If you are the owner of this website:

Contact your hosting provider letting them know your web server is not responding. Additional troubleshooting information.