Home→Forums→MonoBrick EV3 Firmware→Remote control Ev3 by EDIMAX EW-7811-Un
- This topic has 1 reply, 2 voices, and was last updated 10 years, 8 months ago by Anders Søborg.
-
AuthorPosts
-
April 6, 2014 at 16:18 #4120
minghan LiParticipantsorry~
I want to remote control ev3 but i only EDIMAX EW-7811-Un.
So I have to use MonoBrick Firmware.
however that C# code is like this?
→
using System;
using MonoBrick.EV3;
namespace Application
{
public static class Program{
static void Main(string[] args)
{try{
var ev3 = new Brick<Sensor,Sensor,Sensor,Sensor>(“WiFi”);
sbyte speed = 0;
ev3.Connection.Open();
ConsoleKeyInfo cki;
Console.WriteLine(“Press Q to quit”);
do
{
cki = Console.ReadKey(true); //press a key
switch(cki.Key){
case ConsoleKey.R:
Console.WriteLine(“Motor A reverse direction”);
ev3.MotorA.Reverse = !ev3.MotorA.Reverse;
break;
case ConsoleKey.UpArrow:
if(speed < 100)
speed = (sbyte)(speed + 10);
Console.WriteLine(“Motor A speed set to ” + speed);
ev3.MotorA.On(speed);
break;
case ConsoleKey.DownArrow:
if(speed > -100)
speed = (sbyte)(speed – 10);
Console.WriteLine(“Motor A speed set to ” + speed);
ev3.MotorA.On(speed);
break;
case ConsoleKey.S:
Console.WriteLine(“Motor A off”);
speed = 0;
ev3.MotorA.Off();
break;
case ConsoleKey.B:
Console.WriteLine(“Motor A break”);
speed = 0;
ev3.MotorA.Brake();
break;
}
} while (cki.Key != ConsoleKey.Q);
}
catch(Exception e){
Console.WriteLine(“Error: ” + e.Message);
Console.WriteLine(“Press any key to end…”);
Console.ReadKey();
}
}
}
}EDIMAX EW-7811-Un can also use the same code??
thanks~
April 8, 2014 at 19:02 #4122
Anders SøborgKeymasterHi thanks for trying the Monobrick firmware. To remote control the EV3 over a WiFi connection you do not need to use the MonoBrick communication library – in fact if you read closely here you will see that the communication library only works with the standard firmware. To establish a connection from a PC to the EV3 running the MonoBrick firmware you simply need to have a program running on the EV3 that accepts a TCP/IP connection and then have the PC establish a connection. Use google to find one of the many tutorial on how to do this in C#…
Anders
-
AuthorPosts
You must be logged in to reply to this topic.
Follow