Microsoft .NET Interface for LEGO MINDSTORMS
SharpLogic Software
Updated: February 11, 2005

Introduction to LEGO MINDSTORMS

MINDSTORMS are products from LEGO that include everything a developer needs to physically build and program real robots. The typical MINDSTORMS product includes an array of building blocks, motors, sensors, and a central controller, known as the LEGO RCX.

To get started, you’ll need to download and install the free LEGO MINDSTORMS SDK 2.5 from http://mindstorms.lego.com/sdk2point5. This will install the drivers required to send commands to the LEGO MINDSTORM via infrared tower. You’ll also need to install a Visual Studio 2005 product, such as Visual Basic Express Edition 2005, which can be downloaded from http://msdn.microsoft.com/vbasic/.

Programming the LEGO RCX

The LEGO RCX is a brick-shaped component that handles all of the processing and command routing required for the MINDSTORMS robot to function. It makes use of the LEGO assembly instruction set (LASM) to interpret and execute both onboard programs and PC-driven requests. LASM bytecode is sent to the RCX from a PC via infrared data transfer, usually from a tower connected to the PC via USB or RS-232 (serial) cable.

Developers planning to build RCX-based applications have two models to choose from:

1. Download LASM bytecode to the RCX and execute it as a complete application. In this model the entire program is sent to the RCX and it is run independently by the RCX’s processor. This scenario is known as “autonomous” programming since the RCX executes independent of the PC.

2. Send a series of requests from a driver (typically a PC) that instructs the RCX on which actions it must take. In this model the business logic occurs on the PC and only imperative commands are sent to the RCX for processing, such as requests to change motor speed. This scenario is known as “integrated” programming since the RCX can be integrated easily with other applications.

In either model, the driver PC is responsible for assembling LASM bytecode and deploying it to the RCX. This bytecode can be compiled by any model (whether hand assembled or automated via compiler) but is generally deployed using LEGO’s provided infrastructure.

To deploy a list of instructions or requests, a developer will hook LEGO’s GhostAPI.dll, a native Win32 DLL that offers an array of low-level functionality designed to simplify the process of queuing and deploying LASM commands. GhostAPI.dll is dependent on one of two native LEGO DLLs for communicating with the infrared tower: PbkComm32.dll (for RS-232) or PbkUsbPort.dll (for USB). The protocol for the tower itself is handled through TowerAPI.dll, another GhostAPI.dll dependency required with deployment. The tower communicates directly with the RCX via infrared, which reaches from several inches to several (around 15) feet. When deploying applications, be sure to include all four DLLs to support either type of port (GhostAPI.dll, PbkComm32.dll, PbkUsbPort.dll, and TowerAPI.dll).

While LEGO offers several solid solutions for developing autonomous applications based on model 1 from above, the Microsoft .NET Interface for LEGO MINDSTORMS project was designed to enable easy development of integrated model 2 applications using Visual Studio 2005 and the .NET Framework 2.0.

With Microsoft .NET Interface for LEGO MINDSTORMS, a developer can use the .NET Framework language of their choice to develop against a high-level class library that closely resembles the physical model of the MINDSTORMS robots. It includes classes for the RCX, as well as classes for the motors and sensors.

Design Goals

The Microsoft .NET Interface for LEGO MINDSTORMS was designed with developer simplicity in mind. Under this design philosophy, any developer should be able to use the class library to develop an RCX application without having any knowledge of LASM, or of any of the underlying APIs used to communicate with the device, whether at the application or data layers.

Design Overview

Microsoft .NET Interface for LEGO MINDSTORMS wraps LEGO’s GhostAPI.dll and emulates a real-time controller model. Although the RCX itself does not provide event notifications to the driver PC, the Microsoft .NET Interface for LEGO MINDSTORMS library simulates this functionality by polling the RCX regularly on a separate thread, and then invoking changes through an abstract proxy class. The result is that developers are able to enjoy first class .NET support, including support for properties and events, without having to implement the low-level interoperability mechanisms or manage timing.

C4F.LegoRcx.dll

All types exposed by the Microsoft .NET Interface for LEGO MINDSTORMS are available from the C4F.LegoRcx.dll assembly.

The GhostApiWrapper Class

Although hidden from developers consuming the library, the GhostApiWrapper class is probably the most important type in the assembly. It exposes all of LEGO’s GhostAPI.dll functionality required to send requests to the RCX. It is used exclusively by classes in the Microsoft .NET Interface for LEGO MINDSTORMS and isn’t intended to be publicly accessible to developers.

In order to emulate real-time eventing, the GhostApiWrapper spawns a command thread, which requests values for active sensors as often as possible and sends other commands issued through higher-level classes. Although it does have a throttling mechanism to prevent hyper spinning, infrared commands tend to take so long that the command loop doesn’t spin too quickly. The throttle mechanism is mostly useful when no sensors are being polled to ensure that the CPU isn’t floored during the loop.

In order to provide the highest level of performance and realism, the GhostApiWrapper does not directly execute commands upon receipt. Instead, there are three ways commands are sent to the RCX, depending on whether the developer is setting motor properties, retrieving data, or sending other commands. Note that each way is transparent to the developer, who only interacts with higher-level classes.

Setting Motor Properties

In order to move the RCX, its motors must be manipulated through their power and direction settings. Doing this serially, such as setting Motor A’s power to 5, followed by Motor C’s power to 5, would result in jerky movement that doesn’t move the RCX in a straight line (assuming the standard RoverBot configuration). To mitigate this, the GhostApiWrapper class doesn’t directly accept commands to manipulate the motors. Instead, a developer will change the value of the motor’s power in a shared class derived from RcxBase, which the GhostApiWrapper’s command thread will poll and update as necessary in its next iteration. This enables the wrapper to take advantage of packing requests where multiple motors may be manipulated within a single command.

Retrieving Data

Since infrared is used to retrieve data from the device, it can be quite slow at times. As a result, the GhostApiWrapper polls the RCX as often as possible on its command thread and caches the results in the shared RcxBase-based class. Developer access to RCX data is therefore virtually immediate and the results are expected to be fresh within a few hundred milliseconds, except in the case of some properties, such as battery power, which is polled less often (every few seconds).

When a data request response is received from the RCX by the GhostApiWrapper, it updates the RcxBase class shared between the Ghost API wrapping layer and the library’s application layer. Some values, such as sensor values, will raise events if the value has changed.

Sending Other Commands

Outside of manipulating motors and retrieving data there are a set of requests that can be sent to the RCX to perform certain tasks, such as playing tones with the RCX speaker. When these requests are sent to GhostApiWrapper, they are queued with the other pending commands and sent on the command thread in the order they were received.

Public Classes

While there are many classes in C4F.LegoRcx.dll that are used to abstract the Ghost API functionality, the public classes in C4F.LegoRcx.dll are designed to provide a smooth interface for external developers to interact with the RCX itself. As such, only few select types are exposed publicly, and even those types have a subset of their respective properties, methods, and events available for use. Minimizing the surface area of programming enables developers to more quickly and easily understand and implement applications using the interface.

Rcx

The flagship class, Rcx, provides a handful of methods used to manipulate certain properties of the RCX, such as the power down delay time, display, or the speaker, as well as RcxMotor properties that represent each motor and RcxSensor properties for each sensor. When created, the Rcx class will automatically attempt to connect to the device via USB, then via RS-232. If both are unsuccessful, the constructor will still succeed, but the developer is responsible for plugging in a tower and calling the Connect method.

Here are a few examples of using Rcx functionality:

' Create a new Rcx to play with

Me ._rcx = new Rcx ()

' Play a low C note for 200 ms (these two are functionally equivalent)

Me ._rcx.PlayTone ( 33, 20)

Me ._rcx.PlayTone ( RcxNote.C1, 20)

' Set the RCX display to show “99”

Me ._rcx.SetDisplay ( 99)

' Send the message “47” to other RCX devices via our RCX device

Me ._rcx.SendMessage ( 47)

RcxMotor

The RcxMotor class is designed to emulate a physical RCX motor. In order to keep the developer experience as simple as possible, there are only two ways to manipulate the motor: via the Power property and the Off method. Setting the Power property to a positive or negative value ensures the motor is on and sets its direction forward or backward, respectively. Setting a Power of 0 puts the motor in float mode, where the motor is not locked off, but does not have any power. Calling the Off method sets the Power to 0 and locks the motor in the off state.

All access to RcxMotor objects must be through an Rcx class. Here are a few examples of using the RcxMotor:

' Full speed ahead on motor A

Me ._rcx.MotorA.Power = 8

' Back up and to the right (assuming the RoverBot configuration)

Me ._rcx.MotorA.Power = -8

Me ._rcx.MotorC.Power = -4

' Turn off all motors

Me ._rcx.MotorA.Power.Off ()

Me ._rcx.MotorB.Power.Off ()

Me ._rcx.MotorC.Power.Off ()

RcxSensor

The RcxSensor class is designed to emulate a physical RCX sensor. By default, each sensor is set to the RcxSensorType.None type. In order to use the sensor, set it to the appropriate type, such as RcxSensorType.Touch for a touch sensor. Setting the type to something other than None indicates that there is an active sensor attached to the port, which lets the Ghost API wrapper layer know to poll the sensor for its latest value. The current value of an RcxSensor can be read from its Value property, and a developer can subscribe to the ValueChanged event to receive real-time notifications of when the value changes.

All access to RcxSensor objects must be through an Rcx class. Here is an example of configuring a touch sensor and handling its event:

' Configure our sensor 1 as a Touch sensor

Me._rcx.Sensor1.SensorType = RcxSensorType.Touch

' Set up Sensor1_ValueChanged as the event handler for this sensor

AddHandler Me._rcx.Sensor1.ValueChanged, AddressOf Sensor1_ValueChanged

' Handles value changes for sensor 1

Private Sub Sensor1_ValueChanged( ByVal sender As Object, _

ByVal e As RcxSensorValueChangedEventArgs)

Dim pressed As Boolean = (e.Value = 1)

' Do something based on whether the sensor is pressed or not

End Sub

Application Deployment

Applications written using the Microsoft .NET Interface for LEGO MINDSTORMS have all the deployment benefits of .NET Framework 2.0 applications. To begin with, the target machine requires the .NET Framework 2.0 to be installed, which can be downloaded from http://www.microsoft.com/downloads/details.aspx?FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5&DisplayLang=en. Please note that the .NET Framework 2.0 is automatically installed by Visual Studio 2005. In addition, the target machine will require the LEGO MINDSTORMS SDK 2.5 from http://mindstorms.lego.com/sdk2point5 to be installed as well.

Once the target machine has been set up, the easiest way to deploy these applications is to copy the executable and resource files, along with the required DLLs, to a folder on the target machine. While the executable and resource files will vary depending on your particular application, the executable directory will always need to contain C4F.LegoRcx.dll. In addition, this folder will also require GhostApi.dll and either PbkUsbPort.dll (for USB towers) or PbkComm32.dll (for serial towers), which can be found at [Program Files]\LEGO Software\LEGO Mindstorms SDK\Bin\GhostAPI on the target machine after the LEGO MINDSTORMS SDK has been installed.

Sample Applications

Microsoft .NET Interface for LEGO MINDSTORMS ships with three sample applications, each available in VB, C#, managed C++, and J#. These applications are:

RemoteControlSample | Illustrates working with RcxMotors. Note that this sample requires the RovertBot configuration from LEGO’s Constructopedia.
RoverBotSample | Illustrates handling RcxSensor events to maneuver the RCX around obstacles. Note that this sample requires the RovertBot configuration from LEGO’s Constructopedia.
MusicSample | Illustrates working with the Rcx’s speaker via the PlayTone method.

Summary

Microsoft .NET Interface for LEGO MINDSTORMS provides enough functionality to allow hobbyists and students to begin experimenting with robotics and was designed with simplicity in mind as the key focus. A number of example applications were developed to showcase the features of the library and to give programmers a quick start.


C4F.LegoRcx

Microsoft .NET Interface for LEGO MINDSTORMS

C4F.LegoRcx Namespace

Namespace hierarchy

Classes

Class | Description
GhostApiException | Wraps a Ghost API exception based on native API calls.
Rcx | Rcx is the only class you can instantiate from this assembly. Use it to manipulate motors, read data, and perform other tasks.
RcxBatteryPowerChangedEventArgs | Provides event details on battery power changes.
RcxMessageReceivedEventArgs | Provides details on incoming RCX message events.
RcxMotor | Summary description for RcxMotor.
RcxNoteConverter | Utility class for converting RcxNote objects into easier to use values.
RcxSensor | Summary description for RcxSensor.
RcxSensorValueChangedEventArgs | Provides event details on sensor value changes.

Delegates

Delegate | Description
RcxBatteryPowerChangedEventHandler | Delegate for use when handling changes in battery power.
RcxMessageReceivedEventHandler | Delegate for use when handling incoming messages from other RCX devices.
RcxSensorValueChangedEventHandler | Delegate for use when handling changes in sensor values.

Enumerations

Enumeration | Description
GhostApiExceptionSeverity | The severity of this exception. Only Error exceptions are fatal.
RcxMotorState | Motor states
RcxNote | Represents each key on a standard piano, backed by the appropriate hertz value. Use RcxNoteConverter to convert to an integer (or cast to int directly).
RcxPort | The port used by the RCX
RcxSensorType | Sensor types
RcxSoundType | Sound types stored on the RCX brick

Copyright © 2005 Microsoft Corporation, Developed by SharpLogic Software


GhostApiException Class

Wraps a Ghost API exception based on native API calls.

For a list of all members of this type, see GhostApiException Members.

System.Object
System.Exception
C4F.LegoRcx.GhostApiException

public class GhostApiException : Exception

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

GhostApiException Members | C4F.LegoRcx Namespace


GhostApiException Members

GhostApiException overview

Public Instance Properties

Data (inherited from Exception) | Gets a collection of key/value pairs that provide additional, user-defined information about the exception.
HelpLink (inherited from Exception) | Gets or sets a link to the help file associated with this exception.
InnerException (inherited from Exception) | Gets the Exception instance that caused the current exception.
Message | A text explanation of the error.
RawErrorCode | The raw error code returned from the Ghost API.
Severity | Represents how severe the exception is. Only Error exceptions are fatal.
Source (inherited from Exception) | Gets or sets the name of the application or the object that causes the error.
StackTrace (inherited from Exception) | Gets a string representation of the frames on the call stack at the time the current exception was thrown.
TargetSite (inherited from Exception) | Gets the method that throws the current exception.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetBaseException (inherited from Exception) | When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type. GetHashCode is suitable for use in hashing algorithms and data structures like a hash table.
GetObjectData (inherited from Exception) | When overridden in a derived class, sets the SerializationInfo with information about the exception.
GetType (inherited from Exception) | Gets the runtime type of the current instance.
ToString (inherited from Exception) | Creates and returns a string representation of the current exception.

Protected Instance Properties

HResult (inherited from Exception) Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

GhostApiException Class | C4F.LegoRcx Namespace


GhostApiException Properties

The properties of the GhostApiException class are listed below. For a complete list of GhostApiException class members, see the GhostApiException Members topic.

Public Instance Properties

Data (inherited from Exception) | Gets a collection of key/value pairs that provide additional, user-defined information about the exception.
HelpLink (inherited from Exception) | Gets or sets a link to the help file associated with this exception.
InnerException (inherited from Exception) | Gets the Exception instance that caused the current exception.
Message | A text explanation of the error.
RawErrorCode | The raw error code returned from the Ghost API.
Severity | Represents how severe the exception is. Only Error exceptions are fatal.
Source (inherited from Exception) | Gets or sets the name of the application or the object that causes the error.
StackTrace (inherited from Exception) | Gets a string representation of the frames on the call stack at the time the current exception was thrown.
TargetSite (inherited from Exception) | Gets the method that throws the current exception.

Protected Instance Properties

HResult (inherited from Exception) Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception.

See Also

GhostApiException Class | C4F.LegoRcx Namespace


Message Property

Microsoft .NET Interface for LEGO MINDSTORMS

GhostApiException.Message Property

A text explanation of the error.

public override string Message {get;}

See Also

GhostApiException Class | C4F.LegoRcx Namespace


RawErrorCode Property

Microsoft .NET Interface for LEGO MINDSTORMS

GhostApiException.RawErrorCode Property

The raw error code returned from the Ghost API.

public int RawErrorCode {get;}

See Also

GhostApiException Class | C4F.LegoRcx Namespace


Severity Property

Microsoft .NET Interface for LEGO MINDSTORMS

GhostApiException.Severity Property

Represents how severe the exception is. Only Error exceptions are fatal.

public GhostApiExceptionSeverity Severity {get;}

See Also

GhostApiException Class | C4F.LegoRcx Namespace


GhostApiExceptionSeverity Enumeration

The severity of this exception. Only Error exceptions are fatal.

public enum GhostApiExceptionSeverity

Members

Member Name | Description
Error | A fatal error occurred.
Warning | A recoverable error occurred.
Informational | This exception is purely informational.
NoError | No error occurred (the operation succeeded).

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

C4F.LegoRcx Namespace


Rcx Class

Rcx is the only class you can instantiate from this assembly. Use it to manipulate motors, read data, and perform other tasks.

For a list of all members of this type, see Rcx Members.

System.Object
C4F.LegoRcx.Rcx

public class Rcx : IDisposable

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

Rcx Members | C4F.LegoRcx Namespace


Rcx Members

Rcx overview

Public Instance Constructors

Rcx Constructor Default constructor for the RCX. It will try to connect via USB, then via RS-232. If the connections fail, the constructor will still succeed but the user will need to explicitly call Connect after a tower has been plugged in. Default constructor for the RCX. It will try to connect via USB, then via RS-232. If the connections fail, the constructor will still succeed but the user will need to explicitly call Connect after a tower has been plugged in.

Public Instance Properties

BatteryPower | The remaining battery power of the RCX.
Connected | Whether or not the RCX is connected.
FirmwareVersion | The version of the RCX firmware. Note that this value is unlikely to be avilable immediately after the Rcx object is instantiated due to the fact it is polled on a separate thread.
MotorA | The motor connected to RCX position A.
MotorB | The motor connected to RCX position B.
MotorC | The motor connected to RCX position C.
Sensor1 | The sensor connected to RCX position 1.
Sensor2 | The sensor connected to RCX position 2.
Sensor3 | The sensor connected to RCX position 3.

Public Instance Methods

Connect | Connects to the Mindstorm RCX module. Note that this is automatically called for both USB and Serial (if USB fails) in the constructor. You should only need to call this explicitly if this object is created before the tower is plugged in.
Dispose | Overloaded. Releases resources, especially the GhostApiWrapper, which has a very busy thread.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type. GetHashCode is suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
PlaySystemSound | Plays a specified system sound.
PlayTone | Overloaded. Plays a specified tone given an RcxNote and a duration. Note that these notes are queued up on the RCX and played in order, although the buffer is somewhat small, so be careful.
SendMessage | Broadcasts a message to other RCX devices.
SetDisplay | Sets the value on the RCX display.
SetPowerDownDelay | The time an RCX will stay awake while idle before powering down to conserve battery power. Setting this to 0 will disable the power down.
ToString (inherited from Object) | Returns a String that represents the current Object.

Public Instance Events

BatteryPowerChanged | Raises when the remaining battery power has changed on the RCX.
MessageReceived | Raises when a message has been received on the RCX.

Protected Instance Methods

Dispose | Overloaded.
Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

Rcx Class | C4F.LegoRcx Namespace


Rcx Constructor

Default constructor for the RCX. It will try to connect via USB, then via RS-232. If the connections fail, the constructor will still succeed but the user will need to explicitly call Connect after a tower has been plugged in.

public Rcx();

See Also

Rcx Class | C4F.LegoRcx Namespace


Rcx Properties

The properties of the Rcx class are listed below. For a complete list of Rcx class members, see the Rcx Members topic.

Public Instance Properties

BatteryPower | The remaining battery power of the RCX.
Connected | Whether or not the RCX is connected.
FirmwareVersion | The version of the RCX firmware. Note that this value is unlikely to be avilable immediately after the Rcx object is instantiated due to the fact it is polled on a separate thread.
MotorA | The motor connected to RCX position A.
MotorB | The motor connected to RCX position B.
MotorC | The motor connected to RCX position C.
Sensor1 | The sensor connected to RCX position 1.
Sensor2 | The sensor connected to RCX position 2.
Sensor3 | The sensor connected to RCX position 3.

See Also

Rcx Class | C4F.LegoRcx Namespace


BatteryPower Property

Microsoft .NET Interface for LEGO MINDSTORMS

Rcx.BatteryPower Property

The remaining battery power of the RCX.

public int BatteryPower {get;}

See Also

Rcx Class | C4F.LegoRcx Namespace


Connected Property

Microsoft .NET Interface for LEGO MINDSTORMS

Rcx.Connected Property

Whether or not the RCX is connected.

public bool Connected {get;}

See Also

Rcx Class | C4F.LegoRcx Namespace


FirmwareVersion Property

Microsoft .NET Interface for LEGO MINDSTORMS

Rcx.FirmwareVersion Property

The version of the RCX firmware. Note that this value is unlikely to be avilable immediately after the Rcx object is instantiated due to the fact it is polled on a separate thread.

public int FirmwareVersion {get;}

See Also

Rcx Class | C4F.LegoRcx Namespace


MotorA Property

Microsoft .NET Interface for LEGO MINDSTORMS

Rcx.MotorA Property

The motor connected to RCX position A.

public RcxMotor MotorA {get;}

See Also

Rcx Class | C4F.LegoRcx Namespace


MotorB Property

Microsoft .NET Interface for LEGO MINDSTORMS

Rcx.MotorB Property

The motor connected to RCX position B.

public RcxMotor MotorB {get;}

See Also

Rcx Class | C4F.LegoRcx Namespace


MotorC Property

Microsoft .NET Interface for LEGO MINDSTORMS

Rcx.MotorC Property

The motor connected to RCX position C.

public RcxMotor MotorC {get;}

See Also

Rcx Class | C4F.LegoRcx Namespace


Sensor1 Property

Microsoft .NET Interface for LEGO MINDSTORMS

Rcx.Sensor1 Property

The sensor connected to RCX position 1.

public RcxSensor Sensor1 {get;}

See Also

Rcx Class | C4F.LegoRcx Namespace


Sensor2 Property

Microsoft .NET Interface for LEGO MINDSTORMS

Rcx.Sensor2 Property

The sensor connected to RCX position 2.

public RcxSensor Sensor2 {get;}

See Also

Rcx Class | C4F.LegoRcx Namespace


Sensor3 Property

Microsoft .NET Interface for LEGO MINDSTORMS

Rcx.Sensor3 Property

The sensor connected to RCX position 3.

public RcxSensor Sensor3 {get;}

See Also

Rcx Class | C4F.LegoRcx Namespace


Rcx Methods

The methods of the Rcx class are listed below. For a complete list of Rcx class members, see the Rcx Members topic.

Public Instance Methods

Connect | Connects to the Mindstorm RCX module. Note that this is automatically called for both USB and Serial (if USB fails) in the constructor. You should only need to call this explicitly if this object is created before the tower is plugged in.
Dispose | Overloaded. Releases resources, especially the GhostApiWrapper, which has a very busy thread.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type. GetHashCode is suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
PlaySystemSound | Plays a specified system sound.
PlayTone | Overloaded. Plays a specified tone given an RcxNote and a duration. Note that these notes are queued up on the RCX and played in order, although the buffer is somewhat small, so be careful.
SendMessage | Broadcasts a message to other RCX devices.
SetDisplay | Sets the value on the RCX display.
SetPowerDownDelay | The time an RCX will stay awake while idle before powering down to conserve battery power. Setting this to 0 will disable the power down.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Dispose | Overloaded.
Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

Rcx Class | C4F.LegoRcx Namespace


Rcx.Connect Method

Connects to the Mindstorm RCX module. Note that this is automatically called for both USB and Serial (if USB fails) in the constructor. You should only need to call this explicitly if this object is created before the tower is plugged in.

public void Connect(
RcxPort port
);

Parameters

port
The port to use for this RCX.

Example

_rcx.Connect(RcxPort.USB);

See Also

Rcx Class | C4F.LegoRcx Namespace


Dispose Method

Microsoft .NET Interface for LEGO MINDSTORMS

Rcx.Dispose Method

Releases resources, especially the GhostApiWrapper, which has a very busy thread.

Overload List

Releases resources, especially the GhostApiWrapper, which has a very busy thread.

public void Dispose();

protected virtual void Dispose(bool);

See Also

Rcx Class | C4F.LegoRcx Namespace


Rcx.Dispose Method ()

Releases resources, especially the GhostApiWrapper, which has a very busy thread.

public void Dispose();

Implements

IDisposable.Dispose

See Also

Rcx Class | C4F.LegoRcx Namespace | Rcx.Dispose Overload List


Rcx.Dispose Method (Boolean)

protected virtual void Dispose(
bool
);

See Also

Rcx Class | C4F.LegoRcx Namespace | Rcx.Dispose Overload List


Rcx.PlaySystemSound Method

Plays a specified system sound.

public void PlaySystemSound(
RcxSoundType sound
);

Parameters

sound
Sound to play.

See Also

Rcx Class | C4F.LegoRcx Namespace


PlayTone Method

Microsoft .NET Interface for LEGO MINDSTORMS

Rcx.PlayTone Method

Plays a specified tone given an RcxNote and a duration. Note that these notes are queued up on the RCX and played in order, although the buffer is somewhat small, so be careful.

Overload List

Plays a specified tone given an RcxNote and a duration. Note that these notes are queued up on the RCX and played in order, although the buffer is somewhat small, so be careful.

public void PlayTone(RcxNote,int);

Plays a specified tone given a frequency and a duration. Note that these notes are queued up on the RCX and played in order, although the buffer is somewhat small, so be careful.

public void PlayTone(int,int);

See Also

Rcx Class | C4F.LegoRcx Namespace


Rcx.PlayTone Method (RcxNote, Int32)

Plays a specified tone given an RcxNote and a duration. Note that these notes are queued up on the RCX and played in order, although the buffer is somewhat small, so be careful.

public void PlayTone(
RcxNote note,
int duration
);

Parameters

note
The note to play.
duration
Duration of tone in 1/100th of a second.

See Also

Rcx Class | C4F.LegoRcx Namespace | Rcx.PlayTone Overload List


Rcx.PlayTone Method (Int32, Int32)

Plays a specified tone given a frequency and a duration. Note that these notes are queued up on the RCX and played in order, although the buffer is somewhat small, so be careful.

public void PlayTone(
int frequency,
int duration
);

Parameters

frequency
Frequency to play in hertz.
duration
Duration of tone in 1/100th of a second.

See Also

Rcx Class | C4F.LegoRcx Namespace | Rcx.PlayTone Overload List


Rcx.SendMessage Method

Broadcasts a message to other RCX devices.

public void SendMessage(
int message
);

Parameters

message
The message to broadcast.

See Also

Rcx Class | C4F.LegoRcx Namespace


Rcx.SetDisplay Method

Sets the value on the RCX display.

public void SetDisplay(
int display
);

Parameters

display
The number to set on the display.

See Also

Rcx Class | C4F.LegoRcx Namespace


Rcx.SetPowerDownDelay Method

The time an RCX will stay awake while idle before powering down to conserve battery power. Setting this to 0 will disable the power down.

public void SetPowerDownDelay(
int delay
);

Parameters

delay
The time to delay powering down in minutes.

See Also

Rcx Class | C4F.LegoRcx Namespace


Rcx Events

The events of the Rcx class are listed below. For a complete list of Rcx class members, see the Rcx Members topic.

Public Instance Events

BatteryPowerChanged | Raises when the remaining battery power has changed on the RCX.
MessageReceived | Raises when a message has been received on the RCX.

See Also

Rcx Class | C4F.LegoRcx Namespace


Rcx.BatteryPowerChanged Event

Raises when the remaining battery power has changed on the RCX.

public event RcxBatteryPowerChangedEventHandler BatteryPowerChanged;

Event Data

The event handler receives an argument of type RcxBatteryPowerChangedEventArgs containing data related to this event. The following RcxBatteryPowerChangedEventArgs property provides information specific to this event.

Property | Description
BatteryPower | The new battery power.

See Also

Rcx Class | C4F.LegoRcx Namespace


Rcx.MessageReceived Event

Raises when a message has been received on the RCX.

public event RcxMessageReceivedEventHandler MessageReceived;

Event Data

The event handler receives an argument of type RcxMessageReceivedEventArgs containing data related to this event. The following RcxMessageReceivedEventArgs property provides information specific to this event.

Property | Description
Message | The received message.

See Also

Rcx Class | C4F.LegoRcx Namespace


RcxBatteryPowerChangedEventArgs Class

Provides event details on battery power changes.

For a list of all members of this type, see RcxBatteryPowerChangedEventArgs Members.

System.Object
C4F.LegoRcx.RcxBatteryPowerChangedEventArgs

public class RcxBatteryPowerChangedEventArgs

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

RcxBatteryPowerChangedEventArgs Members | C4F.LegoRcx Namespace


RcxBatteryPowerChangedEventArgs Members

RcxBatteryPowerChangedEventArgs overview

Public Instance Properties

BatteryPower The new battery power.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type. GetHashCode is suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

RcxBatteryPowerChangedEventArgs Class | C4F.LegoRcx Namespace


RcxBatteryPowerChangedEventArgs Properties

The properties of the RcxBatteryPowerChangedEventArgs class are listed below. For a complete list of RcxBatteryPowerChangedEventArgs class members, see the RcxBatteryPowerChangedEventArgs Members topic.

Public Instance Properties

BatteryPower The new battery power.

See Also

RcxBatteryPowerChangedEventArgs Class | C4F.LegoRcx Namespace


BatteryPower Property

Microsoft .NET Interface for LEGO MINDSTORMS

RcxBatteryPowerChangedEventArgs.BatteryPower Property

The new battery power.

public int BatteryPower {get;}

See Also

RcxBatteryPowerChangedEventArgs Class | C4F.LegoRcx Namespace


RcxBatteryPowerChangedEventHandler Delegate

Delegate for use when handling changes in battery power.

public delegate void RcxBatteryPowerChangedEventHandler(
object sender,
RcxBatteryPowerChangedEventArgs e
);

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

C4F.LegoRcx Namespace


RcxMessageReceivedEventArgs Class

Provides details on incoming RCX message events.

For a list of all members of this type, see RcxMessageReceivedEventArgs Members.

System.Object
C4F.LegoRcx.RcxMessageReceivedEventArgs

public class RcxMessageReceivedEventArgs

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

RcxMessageReceivedEventArgs Members | C4F.LegoRcx Namespace


RcxMessageReceivedEventArgs Members

RcxMessageReceivedEventArgs overview

Public Instance Properties

Message The received message.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type. GetHashCode is suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

RcxMessageReceivedEventArgs Class | C4F.LegoRcx Namespace


RcxMessageReceivedEventArgs Properties

The properties of the RcxMessageReceivedEventArgs class are listed below. For a complete list of RcxMessageReceivedEventArgs class members, see the RcxMessageReceivedEventArgs Members topic.

Public Instance Properties

Message The received message.

See Also

RcxMessageReceivedEventArgs Class | C4F.LegoRcx Namespace


Message Property

Microsoft .NET Interface for LEGO MINDSTORMS

RcxMessageReceivedEventArgs.Message Property

The received message.

public int Message {get;}

See Also

RcxMessageReceivedEventArgs Class | C4F.LegoRcx Namespace


RcxMessageReceivedEventHandler Delegate

Delegate for use when handling incoming messages from other RCX devices.

public delegate void RcxMessageReceivedEventHandler(
object sender,
RcxMessageReceivedEventArgs e
);

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

C4F.LegoRcx Namespace


RcxMotor Class

Summary description for RcxMotor.

For a list of all members of this type, see RcxMotor Members.

System.Object
C4F.LegoRcx.RcxMotor

public class RcxMotor

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

RcxMotor Members | C4F.LegoRcx Namespace


RcxMotor Members

RcxMotor overview

Public Instance Properties

Power | Gets or sets the current power of the motor. Positive powers indicate forward motion, negative powers indicate reverse motion. A value of 0 will put the motor in float. Typical motors only support values -8 through 8, but we won't stop you here.
State | Represents the current state of the motor. This is read-only, so if you want to turn the motor off, use the Off method. If you want to put it into float, set the power to 0. If you want to turn it on, set the power to a nonzero value.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type. GetHashCode is suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
Off | Turns the motor off and sets the power to 0.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

RcxMotor Class | C4F.LegoRcx Namespace


RcxMotor Properties

The properties of the RcxMotor class are listed below. For a complete list of RcxMotor class members, see the RcxMotor Members topic.

Public Instance Properties

Power | Gets or sets the current power of the motor. Positive powers indicate forward motion, negative powers indicate reverse motion. A value of 0 will put the motor in float. Typical motors only support values -8 through 8, but we won't stop you here.
State | Represents the current state of the motor. This is read-only, so if you want to turn the motor off, use the Off method. If you want to put it into float, set the power to 0. If you want to turn it on, set the power to a nonzero value.

See Also

RcxMotor Class | C4F.LegoRcx Namespace


Power Property

Microsoft .NET Interface for LEGO MINDSTORMS

RcxMotor.Power Property

Gets or sets the current power of the motor. Positive powers indicate forward motion, negative powers indicate reverse motion. A value of 0 will put the motor in float. Typical motors only support values -8 through 8, but we won't stop you here.

public int Power {get; set;}

See Also

RcxMotor Class | C4F.LegoRcx Namespace


State Property

Microsoft .NET Interface for LEGO MINDSTORMS

RcxMotor.State Property

Represents the current state of the motor. This is read-only, so if you want to turn the motor off, use the Off method. If you want to put it into float, set the power to 0. If you want to turn it on, set the power to a nonzero value.

public RcxMotorState State {get;}

See Also

RcxMotor Class | C4F.LegoRcx Namespace


RcxMotor Methods

The methods of the RcxMotor class are listed below. For a complete list of RcxMotor class members, see the RcxMotor Members topic.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type. GetHashCode is suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
Off | Turns the motor off and sets the power to 0.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

RcxMotor Class | C4F.LegoRcx Namespace


RcxMotor.Off Method

Turns the motor off and sets the power to 0.

public void Off();

See Also

RcxMotor Class | C4F.LegoRcx Namespace


RcxMotorState Enumeration

Motor states

public enum RcxMotorState

Members

Member Name | Description
Float | Float (the motor is off and coasting without power)
On | On (the motor is actively running)
Off | Off (the motor is off and locked in position)

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

C4F.LegoRcx Namespace


RcxNote Enumeration

Represents each key on a standard piano, backed by the appropriate hertz value. Use RcxNoteConverter to convert to an integer (or cast to int directly).

public enum RcxNote

Members

Member Name | Description
C8 |
B7 |
B7Flat |
A7Sharp |
A7 |
A7Flat |
G7Sharp |
G7 |
G7Flat |
F7Sharp |
F7 |
E7 |
E7Flat |
D7Sharp |
D7 |
D7Flat |
C7Sharp |
C7 |
B6 |
B6Flat |
A6Sharp |
A6 |
A6Flat |
G6Sharp |
G6 |
G6Flat |
F6Sharp |
F6 |
E6 |
E6Flat |
D6Sharp |
D6 |
D6Flat |
C6Sharp |
C6 |
B5 |
B5Flat |
A5Sharp |
A5 |
A5Flat |
G5Sharp |
G5 |
G5Flat |
F5Sharp |
F5 |
E5 |
E5Flat |
D5Sharp |
D5 |
D5Flat |
C5Sharp |
C5 |
B4 |
B4Flat |
A4Sharp |
A4 |
A4Flat |
G4Sharp |
G4 |
G4Flat |
F4Sharp |
F4 |
E4 |
E4Flat |
D4Sharp |
D4 |
D4FLat |
C4Sharp |
C4 |
B3 |
B3Flat |
A3Sharp |
A3 |
A3Flat |
G3Sharp |
G3 |
G3Flat |
F3Sharp |
F3 |
E3 |
E3Flat |
D3Sharp |
D3 |
D3Flat |
C3Sharp |
C3 |
B2 |
B2Flat |
A2Sharp |
A2 |
A2Flat |
G2Sharp |
G2 |
G2Flat |
F2Sharp |
F2 |
E2 |
E2Flat |
D2Sharp |
D2 |
D2Flat |
C2Sharp |
C2 |
B1 |
B1Flat |
A1Sharp |
A1 |
A1Flat |
G1Sharp |
G1 |
G1Flat |
F1Sharp |
F1 |
E1 |
E1Flat |
D1Sharp |
D1 |
D1Flat |
C1Sharp |
C1 |
B0 |
B0Flat |
A0Sharp |
A0 |

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

C4F.LegoRcx Namespace


RcxNoteConverter Class

Utility class for converting RcxNote objects into easier to use values.

For a list of all members of this type, see RcxNoteConverter Members.

System.Object
C4F.LegoRcx.RcxNoteConverter

public class RcxNoteConverter

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

RcxNoteConverter Members | C4F.LegoRcx Namespace


RcxNoteConverter Members

RcxNoteConverter overview

Public Static Methods

ConvertToFrequency Converts an RcxNote to its equivalent hertz value.

Public Instance Constructors

RcxNoteConverter Constructor Initializes a new instance of the RcxNoteConverter class.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type. GetHashCode is suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

RcxNoteConverter Class | C4F.LegoRcx Namespace


RcxNoteConverter Constructor

Initializes a new instance of the RcxNoteConverter class.

public RcxNoteConverter();

See Also

RcxNoteConverter Class | C4F.LegoRcx Namespace


RcxNoteConverter Methods

The methods of the RcxNoteConverter class are listed below. For a complete list of RcxNoteConverter class members, see the RcxNoteConverter Members topic.

Public Static Methods

ConvertToFrequency Converts an RcxNote to its equivalent hertz value.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type. GetHashCode is suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

RcxNoteConverter Class | C4F.LegoRcx Namespace


RcxNoteConverter.ConvertToFrequency Method

Converts an RcxNote to its equivalent hertz value.

public static int ConvertToFrequency(
RcxNote note
);

Parameters

note
The RcxNote to convert.

Return Value

See Also

RcxNoteConverter Class | C4F.LegoRcx Namespace


RcxPort Enumeration

The port used by the RCX

public enum RcxPort

Members

Member Name | Description
Usb | USB port
RS232 | Serial port

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

C4F.LegoRcx Namespace


RcxSensor Class

Summary description for RcxSensor.

For a list of all members of this type, see RcxSensor Members.

System.Object
C4F.LegoRcx.RcxSensor

public class RcxSensor

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

RcxSensor Members | C4F.LegoRcx Namespace


RcxSensor Members

RcxSensor overview

Public Instance Properties

SensorType | Gets or sets the active sensor type, which helps the RCX determine what the actual value on the sensor is and how to return it to us (in Value).
Value | The latest value of the sensor. Handle the ValueChanged event if you want to get notified of this as it changes.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type. GetHashCode is suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Public Instance Events

ValueChanged Raises when the value of this sensor changes.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

RcxSensor Class | C4F.LegoRcx Namespace


RcxSensor Properties

The properties of the RcxSensor class are listed below. For a complete list of RcxSensor class members, see the RcxSensor Members topic.

Public Instance Properties

SensorType | Gets or sets the active sensor type, which helps the RCX determine what the actual value on the sensor is and how to return it to us (in Value).
Value | The latest value of the sensor. Handle the ValueChanged event if you want to get notified of this as it changes.

See Also

RcxSensor Class | C4F.LegoRcx Namespace


SensorType Property

Microsoft .NET Interface for LEGO MINDSTORMS

RcxSensor.SensorType Property

Gets or sets the active sensor type, which helps the RCX determine what the actual value on the sensor is and how to return it to us (in Value).

public RcxSensorType SensorType {get; set;}

See Also

RcxSensor Class | C4F.LegoRcx Namespace


Value Property

Microsoft .NET Interface for LEGO MINDSTORMS

RcxSensor.Value Property

The latest value of the sensor. Handle the ValueChanged event if you want to get notified of this as it changes.

public int Value {get; set;}

See Also

RcxSensor Class | C4F.LegoRcx Namespace


RcxSensor Events

The events of the RcxSensor class are listed below. For a complete list of RcxSensor class members, see the RcxSensor Members topic.

Public Instance Events

ValueChanged Raises when the value of this sensor changes.

See Also

RcxSensor Class | C4F.LegoRcx Namespace


RcxSensor.ValueChanged Event

Raises when the value of this sensor changes.

public event RcxSensorValueChangedEventHandler ValueChanged;

Event Data

The event handler receives an argument of type RcxSensorValueChangedEventArgs containing data related to this event. The following RcxSensorValueChangedEventArgs property provides information specific to this event.

Property | Description
Value | The new value.

See Also

RcxSensor Class | C4F.LegoRcx Namespace


RcxSensorType Enumeration

Sensor types

public enum RcxSensorType

Members

Member Name | Description
None | No sensor. The sensor's value will not be polled for by the platform.
Custom | Custom sensor. The sensor's value will be a 16-bit unsigned value.
Angle | Angle sensor. The sensor's value will range from 0 to 15, where each increment represents 22.5 degrees rotation.
Light | Light sensor. The sensor's value will range from 0 to 100, representing the percentage of light available (0 for "no light", 100 for "all light").
Temperature | Temperature sensor. The sensor's value will range from 198 to 695, where each increment represents 1/10th degree Celsius.
Touch | Touch sensor. The sensor's value will either be 1 for "pressed" or 0 for "not pressed".

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

C4F.LegoRcx Namespace


RcxSensorValueChangedEventArgs Class

Provides event details on sensor value changes.

For a list of all members of this type, see RcxSensorValueChangedEventArgs Members.

System.Object
C4F.LegoRcx.RcxSensorValueChangedEventArgs

public class RcxSensorValueChangedEventArgs

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

RcxSensorValueChangedEventArgs Members | C4F.LegoRcx Namespace


RcxSensorValueChangedEventArgs Members

RcxSensorValueChangedEventArgs overview

Public Instance Properties

Value The new value.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type. GetHashCode is suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

RcxSensorValueChangedEventArgs Class | C4F.LegoRcx Namespace


RcxSensorValueChangedEventArgs Properties

The properties of the RcxSensorValueChangedEventArgs class are listed below. For a complete list of RcxSensorValueChangedEventArgs class members, see the RcxSensorValueChangedEventArgs Members topic.

Public Instance Properties

Value The new value.

See Also

RcxSensorValueChangedEventArgs Class | C4F.LegoRcx Namespace


Value Property

Microsoft .NET Interface for LEGO MINDSTORMS

RcxSensorValueChangedEventArgs.Value Property

The new value.

public int Value {get;}

See Also

RcxSensorValueChangedEventArgs Class | C4F.LegoRcx Namespace


RcxSensorValueChangedEventHandler Delegate

Delegate for use when handling changes in sensor values.

public delegate void RcxSensorValueChangedEventHandler(
object sender,
RcxSensorValueChangedEventArgs e
);

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

C4F.LegoRcx Namespace


RcxSoundType Enumeration

Sound types stored on the RCX brick

public enum RcxSoundType

Members

Member Name | Description
FastUpwardTones | FastUpwardTones sound
LowBuzz | LowBuzz sound
UpwardTones | UpwardTones sound
DownwardTones | DownwardTones sound
BeepBeep | BeepBeep sound
Blip | Blip sound

Requirements

Namespace: C4F.LegoRcx

Assembly: C4F.LegoRcx (in C4F.LegoRcx.dll)

See Also

C4F.LegoRcx Namespace


C4F.LegoRcxHierarchy

Microsoft .NET Interface for LEGO MINDSTORMS

C4F.LegoRcx Hierarchy

System.Object
C4F.LegoRcx.Rcx ---- System.IDisposable
C4F.LegoRcx.RcxBatteryPowerChangedEventArgs
C4F.LegoRcx.RcxMessageReceivedEventArgs
C4F.LegoRcx.RcxMotor
C4F.LegoRcx.RcxNoteConverter
C4F.LegoRcx.RcxSensor
C4F.LegoRcx.RcxSensorValueChangedEventArgs
System.Delegate ---- System.ICloneable, System.Runtime.Serialization.ISerializable
System.MulticastDelegate
C4F.LegoRcx.RcxBatteryPowerChangedEventHandler
C4F.LegoRcx.RcxMessageReceivedEventHandler
C4F.LegoRcx.RcxSensorValueChangedEventHandler
System.Exception ---- System.Runtime.Serialization.ISerializable
C4F.LegoRcx.GhostApiException
System.ValueType
System.Enum ---- System.IComparable, System.IConvertible, System.IFormattable
C4F.LegoRcx.GhostApiExceptionSeverity
C4F.LegoRcx.RcxMotorState
C4F.LegoRcx.RcxNote
C4F.LegoRcx.RcxPort
C4F.LegoRcx.RcxSensorType
C4F.LegoRcx.RcxSoundType

See Also

C4F.LegoRcx Namespace