Manipulation of Lego Mindstorms NXT device.
Namespace:
AForge.Robotics.LegoAssembly: AForge.Robotics.Lego (in AForge.Robotics.Lego.dll) Version: 2.1.1.0 (2.1.1.0)
Syntax
| C# |
|---|
public class NXTBrick |
Remarks
The class allows to manipulate with Lego Mindstorms NXT device, setting/getting its motors' state, getting information about sensors' values and retrieving generic information about the NXT brick.

Sample usage:
// create an instance of NXT brick NXTBrick nxt = new NXTBrick( ); // connect to the device if ( nxt.Connect( "COM8" ) ) { // run motor A NXTBrick.MotorState motorState = new NXTBrick.MotorState( ); motorState.Power = 70; motorState.TurnRatio = 50; motorState.Mode = NXTBrick.MotorMode.On; motorState.Regulation = NXTBrick.MotorRegulationMode.Idle; motorState.RunState = NXTBrick.MotorRunState.Running; motorState.TachoLimit = 1000; nxt.SetMotorState( NXTBrick.Motor.A, motorState ); // get input value from the first sensor NXTBrick.SensorValues sensorValues; if ( nxt.GetSensorValue( NXTBrick.Sensor.First, out sensorValues ) ) { // ... } // ... }