This project has moved and is read-only. For the latest updates, please go here.

How to code for Wifi connection ?

Jan 15, 2014 at 12:43 AM
Hi all,

I have a WIFI dongle on the Lego EV3 Brick and I want to connect to it using the
WPF SampleApp. What do I put for the IPAddress ?
do I do an IPCONFIG on my PC and use that value ?
        private ICommunication CreateConnection()
            ICommunication returnType = null;

            switch (ConnControl.GetConnectionType())
                case ConnectionType.Bluetooth:
                    returnType = new BluetoothCommunication(ConnControl.GetComportNumber());
                case ConnectionType.Usb:
                    returnType = new UsbCommunication();
                case ConnectionType.WiFi:
                    returnType = new NetworkCommunication(ConnControl.__GetIpAddress());__

            return returnType;
Thanks, Paul
Jan 15, 2014 at 2:31 AM
You need the IP address of the brick. See the WiFi section in the documentation:
Jan 16, 2014 at 4:22 AM
Thanks PeekB,

I read thru the Getting Started docs.

I was able to use the USB Connection to connect the WiFi to my local WIFI Router.
I was able to see the IP address in the brick.
    private async void Connect_Click(object sender, RoutedEventArgs e)

_brick = new Brick(new UsbCommunication());
// _brick = new Brick(new NetworkCommunication(""));
   _brick.BrickChanged += brick_BrickChanged;

await _brick.ConnectAsync();
Output.Text = "Connected";
        catch (Exception ex)
MessageBox.Show("Failed to connect: " + ex);
  1. Test with
    _brick = new Brick(new UsbCommunication());
    and the USB cable connected to the brick
( I turn off Bluetooth and Wifi on the Brick )

I get an exception:
  • $exception {"No LEGO EV3s found in HID device list."} System.Exception
  • Test with
    _brick = new Brick(new NetworkCommunication(""));
I turn Wifi on in the brick.

But the _await brick.ConnectAsync();
method runs and doesn't drop thru to the next statement to show Connected
and also doesn't hit the catch.

Appreciate any help.

Thanks, Paul
Jan 16, 2014 at 5:01 AM
Edited Jan 20, 2014 at 4:01 AM
Hey PeekB,

So, I figured out that having the Lego Mindstorms Program running at the same time as the
my Lego.EV3 WPF test program was causing the problem in both cases above.

After closing Lego program, the DotNet WPF program started working with both Wifi and USB.
I didn't try the Bluetooth yet.

Thanks, Paul


Turning WIFI on Brick requires using the Lego IDE ( lower right hand corner ) with the USB cable connected to your PC.
Here you specify to have the Brick Connect to your WIFI Router and login.
The other way is to go the Brick Settings on the Brick and connect from the brick itself and specify the WIFI password.
This was such a pain to do for me.

Then have your current project run a quick test ( such as playing a sound on the brick ) using the WIFI connection ( after disconnecting the USB Cable ).
With this WIFI test in the Lego IDE complete, you can close the Lego IDE and return to VS 2013 to run the program ( in my case the WPF Test program ).

WIFI IP Addresss is needed in the .Net Connection logic
After you have connected using Wifi on the brick, you need to go to the Brick Settings to see the IP address assigned
( see the Gettting Started Docs on this site for that ).