<p>First, you need to learn how to make a TCP connection to your EV3. There is a good guide on this <a href="http://www.monobrick.dk/guides/how-to-establish-a-wifi-connection-with-the-ev3-brick/" rel="nofollow noreferrer">here</a>.</p>

<p>Then you need to learn about EV3 VM <a href="http://ev3.fantastic.computer/doxygen/bytecodes.html" rel="nofollow noreferrer">bytecodes</a> and how to send <a href="http://ev3.fantastic.computer/doxygen/communication.html" rel="nofollow noreferrer">direct commands</a>.</p>

<p>Since you are using Unity, you may be able to use a pre-existing library such as the <a href="http://www.monobrick.dk/software/monobrick/" rel="nofollow noreferrer">MonoBrick Communication Library</a> or the <a href="https://github.com/BrianPeek/legoev3/wiki" rel="nofollow noreferrer">Brian Peek library</a>.</p>

<p>To send a variable, you need to use <a href="http://ev3.fantastic.computer/doxygen/cCom.html" rel="nofollow noreferrer">mailbox commands</a> along with "Messaging" blocks in the EV3-G software.</p>

CC BY-SA 3.0
2017-02-01T13:11:42.943Z
this helped finding an answer. thank you.
dichterDichter
CC BY-SA 3.0
2017-01-31T17:29:31.503Z
2017-01-31T17:29:31.503Z
David Lechner
<p>so... after talking to some people and having a sleeples night i switched to monobrick firmware and started a small webserver.</p>

<pre><code>    namespace MonoBrickHelloWorld
{
    class Program
    {
        public static void Main (string[] args)
        {

            //LcdConsole.WriteLine ("Startup");

            HttpListener httpListener = new HttpListener();
            httpListener.Prefixes.Add("http://*:9090/");
            httpListener.Start();

            var run = true;

            (new ButtonEvents()).EscapePressed += () =&gt; run = false;

            while (run)
            {
                var context = httpListener.GetContext();
                Process(context);
            }
        } //Main Ende


        private static void Process(HttpListenerContext context)
        {
            string reqPath = context.Request.Url.AbsolutePath;


            //Console.WriteLine(reqPath);
            LcdConsole.WriteLine (reqPath);
            //

        }// Process End

    } //class Program end
}
</code></pre>

<p>i will split the url send to my ev3 and start different things. wow. 
Source: <a href="http://www.monobrick.dk/forums/topic/webserver/" rel="nofollow noreferrer">http://www.monobrick.dk/forums/topic/webserver/</a></p>

CC BY-SA 3.0
2017-02-01T13:11:22.663Z
2017-02-01T13:11:22.663Z
dichterDichter
<p>I'm trying to connect my EV3 via Wifi to my Unity game. Is there a simple way to send a command to the EV3?</p>

<p>I gave the EV3 a fixed IP and I'm getting the broadcast which the device is sending. So there is a connection. Can I send a variable or something to my EV3?</p>

<ev3><mindstorms><wi-fi>
Send variable to EV3 via WiFi
dichterDichter
# Send variable to EV3 via WiFi

(Asked by: username_0 on 2017-01-31)

I'm trying to connect my EV3 via Wifi to my Unity game. Is there a simple way to send a command to the EV3?

I gave the EV3 a fixed IP and I'm getting the broadcast which the device is sending. So there is a connection. Can I send a variable or something to my EV3?

**Tags:** ev3, mindstorms, wi-fi


---

## 2 answers

### Answer by username_1 on 2017-01-31. Score: 1

First, you need to learn how to make a TCP connection to your EV3. There is a good guide on this [here](http://www.monobrick.dk/guides/how-to-establish-a-wifi-connection-with-the-ev3-brick/).

Then you need to learn about EV3 VM [bytecodes](http://ev3.fantastic.computer/doxygen/bytecodes.html) and how to send [direct commands](http://ev3.fantastic.computer/doxygen/communication.html).

Since you are using Unity, you may be able to use a pre-existing library such as the [MonoBrick Communication Library](http://www.monobrick.dk/software/monobrick/) or the [Brian Peek library](https://github.com/BrianPeek/legoev3/wiki).

To send a variable, you need to use [mailbox commands](http://ev3.fantastic.computer/doxygen/cCom.html) along with "Messaging" blocks in the EV3-G software.

> **Comments:**
> **username_0**: this helped finding an answer. thank you.  

---

### Answer by username_0 on 2017-02-01. Score: 0

so... after talking to some people and having a sleeples night i switched to monobrick firmware and started a small webserver.
    namespace MonoBrickHelloWorld
{
    class Program
    {
        public static void Main (string[] args)
        {

            //LcdConsole.WriteLine ("Startup");

            HttpListener httpListener = new HttpListener();
            httpListener.Prefixes.Add("http://*:9090/");
            httpListener.Start();

            var run = true;

            (new ButtonEvents()).EscapePressed += () => run = false;

            while (run)
            {
                var context = httpListener.GetContext();
                Process(context);
            }
        } //Main Ende


        private static void Process(HttpListenerContext context)
        {
            string reqPath = context.Request.Url.AbsolutePath;


            //Console.WriteLine(reqPath);
            LcdConsole.WriteLine (reqPath);
            //

        }// Process End

    } //class Program end
}

i will split the url send to my ev3 and start different things. wow. 
Source: http://www.monobrick.dk/forums/topic/webserver/


---

