Manipulation of Lego Mindstorms RCX device.

Namespace:  AForge.Robotics.Lego
Assembly:  AForge.Robotics.Lego (in AForge.Robotics.Lego.dll) Version: (


[ObsoleteAttribute("The class is deprecated.")]
public class RCXBrick


The class allows to manipulate with Lego Mindstorms RCX device, setting its motors' state, getting information about sensors' values and performing some other manipulations.

Note:The class supports both types of IR towers - USB and serial (see RCXBrick..::.IRTowerType).

Note:The class uses GhostAPI to communicate with Lego RCX device, so its libraries (GhostAPI.dll, PbkComm32.dll and PbkUsbPort.dll) should be placed into applications folder.

Note:The class is deprecated.

Sample usage:

// create an instance of RCX brick
RCXBrick rcx = new RCXBrick( );
// connect to the device
if ( rcx.Connect( RCXBrick.IRTowerType.USB ) )
    // set forward direction of motor A
    rcx.SetMotorDirection( RCXBrick.Motor.A, true );
    // set power of motor
    rcx.SetMotorPower( RCXBrick.Motor.A, 1 );
    // turm motor on
    rcx.SetMotorOn( RCXBrick.Motor.A, true );
    // ...
    // turn off motors A, B and C
    rcx.SetMotorOn( RCXBrick.Motor.ABC, false );

    // get first sensor's value
    short value;

    if ( rcx.GetSensorValue( RCXBrick.Sensor.First, out value ) )
        // ...
    // ...

Inheritance Hierarchy


See Also