Lego-Mindstorms

Lego Mindstorms (.NET Standard)

This library is heavily based on @BrianPeek’s excellent work https://github.com/BrianPeek/legoev3.

Rewrite of the Lego.Ev3 library to support .NET Core

Project Structure

Source code is in the /Lego.Mindstorms directory. A sample console project is in the /Lego.Mindstorms.Client directory.

Prerequisites

Quick start

  1. Clone this repository in an empty directory:

     git clone https://github.com/seesharprun/Lego-Mindstorms .
    
  2. Connect your brick to your computer using a USB cable. For the test client, connect a large or small motor to Port A.

  3. Use the .NET CLI to execute the test project:

     dotnet run --project Lego.Mindstorms.Client/Lego.Mindstorms.Client.csproj
    

Code Sample (C#)

using (var communication = new UsbCommunication())
using (var client = new Lego.Mindstorms.MindstormsClient<UsbCommunication>(communication))
{
    await client.ConnectAsync();

    await client.TurnMotorAtPowerForTimeAsync(OutputPort.A, 50, 3000u, false);

    await client.PlayToneAsync(50, 5000, 500);
}

Project Release

Version 1.x of the library has been released to NuGet. This is a 1-to-1 port of the BrianPeek/legoev3 project to .NET Standard with minimal code changes.

NuGet Package

https://www.nuget.org/packages/Lego.Mindstorms/

Goals