TWC9: New Windows 10, New Surface Book, New Visual Studio, New Web Documentation and…

As developers, we're always excited to see the next generation take interest in science, technology, engineering and mathematics (STEM). That interest is shared by our friends over at LEGO Education, the people responsible for the new LEGO MINDSTORMS EV3. Inspired by their new robotics kits, we created SentryBot with MINDSTORMS, two Surface Pros and new Windows 8.1 APIs to demo at Build 2013.
Now that Windows 8.1 and the MINDSTORMS EV3 are available publically, we're releasing an API for you to make whatever robotic future you (or your kids) can dream up. The API provides access to control the motors and read real-time data from the sensors. You can connect to and control your LEGO EV3 brick over Bluetooth, WiFi, or USB. The project provides libraries that are usable from the Windows desktop, Windows Phone 8, and WinRT (via .NET, WinJS and C++), along with full source code and samples.
Head over to CodePlex and check out the source code at http://legoev3.codeplex.com/
It's awesome! I must buy it Controlling LEGO robot via WP8 is a nice feature.
Cool! thanks a lot for that introduction to LEGO MINDSTORMS EV3
Great! I love Lego...
Awesome kiddy Fun with Lego and Windows Phone.
First time using the API!
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using Lego.Ev3.Core; using Lego.Ev3.Desktop; namespace andre_probeer_lego_ev3 { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { private Brick _brick; Int16 _vooruit = 5; Int16 _achteruit = -5; Int16 _snelheid = 10; uint _tijd = 1000; public MainWindow() { InitializeComponent(); } private async void Grid_Loaded(object sender, RoutedEventArgs e) { _brick = new Brick(new NetworkCommunication("192.168.178.19")); _brick.BrickChanged += _brick_BrickChanged; await _brick.ConnectAsync(); await _brick.DirectCommand.PlayToneAsync(20, 850, 1000); Project.Content = "Lego EV3 PA0AKV 2013"; Display.Content = "Start"; } void _brick_BrickChanged(object sender, BrickChangedEventArgs e) { //throw new NotImplementedException(); } private async void Achteruit_Click(object sender, RoutedEventArgs e) { await _brick.DirectCommand.TurnMotorAtPowerForTimeAsync(OutputPort.B | OutputPort.C,_achteruit,_tijd, false); } private async void Vooruit_Click(object sender, RoutedEventArgs e) { await _brick.DirectCommand.TurnMotorAtPowerForTimeAsync(OutputPort.B | OutputPort.C, _vooruit, _tijd, false); } private async void Links_Click(object sender, RoutedEventArgs e) { _brick.BatchCommand.TurnMotorAtPowerForTime(OutputPort.B, _vooruit, _tijd, false); _brick.BatchCommand.TurnMotorAtPowerForTime(OutputPort.C, _achteruit, _tijd, false); await _brick.BatchCommand.SendCommandAsync(); } private async void Rechts_Click(object sender, RoutedEventArgs e) { _brick.BatchCommand.TurnMotorAtPowerForTime(OutputPort.C, _vooruit, _tijd, false); _brick.BatchCommand.TurnMotorAtPowerForTime(OutputPort.B, _achteruit, _tijd, false); await _brick.BatchCommand.SendCommandAsync(); } private void Regelaar_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) { _snelheid = Convert.ToInt16(Regelaar.Value); Display.Content = Regelaar.Value; Vooruit1.Content = _snelheid; Achteruit1.Content = _snelheid * -1; _vooruit = _snelheid; _achteruit =Convert.ToInt16(_vooruit * -1); } } }
It opens a form and with the slider you can manage the speed!
It is important to change the wifi IP adress otherwise the brick cannot connect!
If you like the program I can mail it to you!
This is my first C# program and it is not documented yet but it will come!
You could also use the MonoBrick library found at http://www.monobrick.dk/software/monobrick/
It works with Mac OS, Linux and Windows using Mono. Apparently it also works with Windows Phone and Android.
You are right, I also made the same thing with monobrick. I still do not know wich is the easiest way!
www.youtube.com/watch?v=vciztvXg4Yk
Thanks for this nice Video. Time to get into it.
How do you record this video? What software do you use?
Can you provide a link to the sample program with the 4 buttons.
The sample download doesn't have that example and I don't know XAML.
Thanks, RC
Also, with the Lego EV3 IDE you can create a Project and create programs and then download to the brick to run.
Can we do that ( create a program and download to the brick ) with the API ?
Thanks, RC
@Gert Heriksen: I tried to use MonoBrick, and I'm sure that it works when done correctly, but I found this one much easier to configure. I spent a long time trying to get MonoBrick to work, but never succeeded. But when I found this, I was able to get it installed, setup, and working in just a day or two. I think both are probably great and probably relatively easy to use once they are setup, but I still recommend Lego.EV3 because CodePlex has good forums and is very reliable. Also, the fact that Lego.EV3 can be installed using NuGet in Visual Studio is a good bonus.
Does the .net API presented in he video allow to get motor stress level from servos?
Thank you
@pa0akv: Just got the link and am a beginner in C# Programming. Already doing pretty well with the building of the LEGO ROBOTS. The programming part now is my interest. Please send me the program I give it a try. My email:sumbuko2000@yahoo.com
can any one help me how to control ev3 motor by angle.
for example - what code I use to lets say move motor 30 degree angle.
I am trying to use following function that has steps input but I don't feel like steps and angle are related as I get different degree for same steps.
await _brick.DirectCommand.StepMotorAtPowerAsync(OutputPort.A, fwd_power, _steps, false);
During the part about the motors, each time I start the test app, it runs the motor during the form load part. It only does this if I sent a move forward or backwards motor command in a previous run. What is causing this? I am currently using the api from nugget.
NICE BUT I CANT AFFORD IT BUT U KNOW GUYS ITS TOO EXPENSIVE
I can't connect to my EV3 via Bluetooth in a ASP.NET Core2 Web application!
It says:
"An unhandled exception occurred while processing the request.
FileNotFoundException: Could not load file or assembly 'System.IO.Ports, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. System cannot find the file specified.
Lego.Ev3.Desktop.BluetoothCommunication..ctor(string port)"
Let me notice, it worked in ASP.NET Framework and in WPF application, but in a Core2 app, it doesn't... Please fix this somehow or please help me!
I would like to see an example of this library being used from C++ visual studio 2017. Would you be able to provide that?
Thanks.