Home / Programming / C# / Talking to your EV3: EV3Messenger

Talking to your EV3: EV3Messenger

EV3Messenger - PC side I was contacted Joeri van Belle last week about a new project that he is working on, a C# project that allows you to send messages to your EV3.  Using it, you can send and receive messages between your EV3 brick and PC. On the brick you can use the standard BT communication blocks, so you can do this without any special tricks.

The project comes with a simple UI that you can use to pass messages back and forth.  It merely serves as an example for the library, so you can see how to use it.

To use the library you will need at least Visual Studio 2010.  I tried to load it in Visual Studio 2008, which is what I have installed on my computer now, but that didn’t work.  Apart from the EV3MessengerSetup project, everything seems to work just fine with the new Visual Studio 2013.  I didn’t seem to need it to run it from inside Visual Studio.

private void readTimer_Tick(object sender, EventArgs e) 
{ 
    if (messenger.IsConnected) 
    { 
        EV3Message message = messenger.ReadMessage(); 
        if (message != null) 
        {   
            // a message was present and is read. 
            receivedMessagesListBox.Items.Add(message); 
        } 
    } 
    else 
    { 
        readTimer.Stop(); 
        UpdateButtonsAndConnectionInfo(); 
    } 
}

EV3Messenger - EV3 sideI did some digging around in the code, and the implementation code for the example program pictured above seems pretty straight forward.  It uses a simple timer based polling mechanism and for now at least, doesn’t look like it can generate events.  Joeri tells me that this is to make it more suitable for teaching programming basics to his pupils.

If you’re looking for a simple way to pass messages back and forth between your PC and EV3, check this project out.

You can find all the code and a guide to get it up and running on Codeplex: [LINK].

Program running on the EV3 (comments stripped)

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.