Method | Description | |
---|---|---|
ClearSensor ( Sensor sensor ) : bool |
Clear sensor's scaled value.
|
|
ClearSensor ( Sensor sensor, bool waitReply ) : bool |
Clear sensor's scaled value.
|
|
Connect ( string portName ) : bool |
Connect to NXT brick. If connection to NXT brick was established before the call, existing connection will be reused. If it is required to force reconnection, then Disconnect method should be called before. |
|
Disconnect ( ) : void |
Disconnect from Lego NXT brick.
|
|
GetBatteryPower ( int &power ) : bool |
Get battery power of NXT brick.
|
|
GetDeviceInformation ( string &deviceName, byte &btAddress, int &btSignalStrength, int &freeUserFlash ) : bool |
Get information about NXT device.
|
|
GetMotorState ( Motor motor, MotorState &state ) : bool |
Get motor state.
|
|
GetSensorValue ( Sensor sensor, SensorValues &sensorValues ) : bool |
Get sensor's values.
|
|
GetUltrasonicSensorsValue ( Sensor sensor, int &value ) : bool |
Read value of ultrasonic distance sensor. The method retrieves value of ultrasonic distance sensor by communicating with I2C device (writing to and reading from low speed bus). The method first sends { 0x02, 0x42 } command to the specified device using LsWrite( Sensor, byte[], int ) method. Then it waits until there is something available to read using LsGetStatus method. Finally it reads sensor's value using LsRead device. See this page for details. |
|
GetVersion ( string &protocolVersion, string &firmwareVersion ) : bool |
Get firmware version of NXT brick.
|
|
IsAlive ( ) : bool |
Check if the NXT brick is alive and responds to messages. The command also keeps NXT brick alive preventing it from sleep. |
|
LsGetStatus ( Sensor sensor, int &readyBytes ) : bool |
Get status of Low Speed bus.
|
|
LsRead ( Sensor sensor, byte readValues, int &bytesRead ) : bool |
Read data from Low Speed bus.
|
|
LsWrite ( Sensor sensor, byte data, int expectedBytes ) : bool |
Write to Low Speed bus.
|
|
LsWrite ( Sensor sensor, byte data, int expectedBytes, bool waitReply ) : bool |
Write to Low Speed bus.
|
|
NXTBrick ( ) : System |
Initializes a new instance of the NXTBrick class.
|
|
PlayTone ( short frequency, short duration ) : bool |
Play tone of specified frequency.
|
|
PlayTone ( short frequency, short duration, bool waitReply ) : bool |
Play tone of specified frequency.
|
|
ReadHiTechnicAccelerationTiltSensor ( |
Read data from HiTechnic acceleration/tilt sensor. The HiTechnic accelerometer/tilt sensor measures acceleration in three axes. It measures also tilt along each axis. Using the sensor, you can measure the acceleration of your robot in the range of -2g to 2g. The method retrieves the acceleration in three directions of a HiTechnic acceleration/tilt sensor by communicating with I2C device (writing to and reading from low speed bus). The method first sends { 0x02, 0x42 } command to the specified device using LsWrite( Sensor, byte[], int ) method. Then it waits until there is something available to read using LsGetStatus method. Finally it reads sensor's value using LsRead device. See this page for details. The acceleration sensor can also be used to measure tilt in three axes This is possible because gravity is perceived as acceleration. When the sensor is stationary and in the normal horizontal position, the x and y axis will be near zero, because they are horizontal, while the z axis will be near 200, which represents g. If you tilt the sensor then gravity will also be detected on the other axis and the value for the z axis will go down. Since gravity is distributed among the three component vectors, the tilt of the sensor can be determined. |
|
ReadHiTechnicColorSensor ( |
Read data from HiTechnic color sensor (also color sensor v2). The method retrieves the color valuse of a HiTechnic color sensor by communicating with I2C device (writing to and reading from low speed bus). The method first sends { 0x02, 0x42 } command to the specified device using LsWrite( Sensor, byte[], int ) method. Then it waits until there is something available to read using LsGetStatus method. Finally it reads sensor's value using LsRead device. See this page for details. |
|
ReadHiTechnicCompassSensor ( |
Read data from HiTechnic compass sensor. The method retrieves the angle of a HiTechnic compass sensor by communicating with I2C device (writing to and reading from low speed bus). The method first sends { 0x02, 0x42 } command to the specified device using LsWrite( Sensor, byte[], int ) method. Then it waits until there is something available to read using LsGetStatus method. Finally it reads sensor's value using LsRead device. See this page for details. |
|
ResetMotorPosition ( Motor motor, bool relative ) : bool |
Reset motor's position.
|
|
ResetMotorPosition ( Motor motor, bool relative, bool waitReply ) : bool |
Reset motor's position.
|
|
SendCommand ( byte command, byte reply ) : bool |
Send command to Lego NXT brick and read reply.
|
|
SetBrickName ( string deviceName ) : bool |
Set name of NXT device.
|
|
SetMotorState ( Motor motor, MotorState state ) : bool |
Set motor state.
|
|
SetMotorState ( Motor motor, MotorState state, bool waitReply ) : bool |
Set motor state.
|
|
SetSensorMode ( Sensor sensor, SensorType type, SensorMode mode ) : bool |
Set sensor's type and mode.
|
|
SetSensorMode ( Sensor sensor, SensorType type, SensorMode mode, bool waitReply ) : bool |
Set sensor's type and mode.
|
public ClearSensor ( Sensor sensor ) : bool | ||
sensor | Sensor | Sensor to clear value of. |
return | bool |
public ClearSensor ( Sensor sensor, bool waitReply ) : bool | ||
sensor | Sensor | Sensor to clear value of. |
waitReply | bool | Wait reply from NXT (safer option) or not (faster option). |
return | bool |
public Connect ( string portName ) : bool | ||
portName | string | Serial port name to use for communication, for example COM1. |
return | bool |
public GetBatteryPower ( int &power ) : bool | ||
power | int | NXT brick's battery power in millivolts. |
return | bool |
public GetDeviceInformation ( string &deviceName, byte &btAddress, int &btSignalStrength, int &freeUserFlash ) : bool | ||
deviceName | string | Device name. |
btAddress | byte | Bluetooth address. |
btSignalStrength | int | Bluetooth signal strength. |
freeUserFlash | int | Free user Flash. |
return | bool |
public GetMotorState ( Motor motor, MotorState &state ) : bool | ||
motor | Motor | Motor to get state for. |
state | MotorState | Motor's state. |
return | bool |
public GetSensorValue ( Sensor sensor, SensorValues &sensorValues ) : bool | ||
sensor | Sensor | Sensor to get values of. |
sensorValues | SensorValues | etrieved sensor's values. |
return | bool |
public GetUltrasonicSensorsValue ( Sensor sensor, int &value ) : bool | ||
sensor | Sensor | Sensor to read value from. |
value | int | Distance value obtained from ultrasonic sensor, [0..255] cm. |
return | bool |
public GetVersion ( string &protocolVersion, string &firmwareVersion ) : bool | ||
protocolVersion | string | Protocol version number. |
firmwareVersion | string | Firmware version number. |
return | bool |
public LsGetStatus ( Sensor sensor, int &readyBytes ) : bool | ||
sensor | Sensor | Sensor to get the status from. |
readyBytes | int | Number of bytes that are ready to be read from the bus. |
return | bool |
public LsRead ( Sensor sensor, byte readValues, int &bytesRead ) : bool | ||
sensor | Sensor | Sensor to read data from. |
readValues | byte | Array to read data to. |
bytesRead | int | Bytes actually read from I2C device. |
return | bool |
public LsWrite ( Sensor sensor, byte data, int expectedBytes ) : bool | ||
sensor | Sensor | Sensor to write to. |
data | byte | Data to send to the I2C device. |
expectedBytes | int | Number of bytes expected from device on reply, [0..16]. /// Can be set to zero if I2C command does not suppose any reply. |
return | bool |
public LsWrite ( Sensor sensor, byte data, int expectedBytes, bool waitReply ) : bool | ||
sensor | Sensor | Sensor to write to. |
data | byte | Data to send to the I2C device. |
expectedBytes | int | Number of bytes expected from device on reply, [0..16]. /// Can be set to zero if I2C command does not suppose any reply. |
waitReply | bool | Wait reply from NXT (safer option) or not (faster option). |
return | bool |
public PlayTone ( short frequency, short duration ) : bool | ||
frequency | short | Tone frequency in Hz. |
duration | short | Tone duration in milliseconds. |
return | bool |
public PlayTone ( short frequency, short duration, bool waitReply ) : bool | ||
frequency | short | Tone frequency in Hz. |
duration | short | Tone duration in milliseconds. |
waitReply | bool | Wait reply from NXT (safer option) or not (faster option). |
return | bool |
public ReadHiTechnicAccelerationTiltSensor ( |
||
sensor | Sensor to read from. | |
xAceeleration | int | Acceleration in X direction, with a scaling of approximately 200 counts per g. |
yAceeleration | int | Acceleration in Y direction, with a scaling of approximately 200 counts per g. |
zAceeleration | int | Acceleration in Z direction, with a scaling of approximately 200 counts per g. |
return | bool |
public ReadHiTechnicColorSensor ( |
||
sensor | Sensor to read from. | |
colorNumber | int | Found color number. |
redValue | int | Found red value. |
greenValue | int | Found green value. |
blueValue | int | Found blue value. |
return | bool |
public ReadHiTechnicCompassSensor ( |
||
sensor | Sensor to read from. | |
angle | int | The magnetic heading, [0, 359] degrees. |
return | bool |
public ResetMotorPosition ( Motor motor, bool relative ) : bool | ||
motor | Motor | Motor to reset. |
relative | bool | Specifies if relative (to last movement) or absolute motor's /// position should reset. |
return | bool |
public ResetMotorPosition ( Motor motor, bool relative, bool waitReply ) : bool | ||
motor | Motor | Motor to reset. |
relative | bool | Specifies if relative (to last movement) or absolute motor's /// position should reset. |
waitReply | bool | Wait reply from NXT (safer option) or not (faster option). |
return | bool |
public SendCommand ( byte command, byte reply ) : bool | ||
command | byte | Command to send. |
reply | byte | Buffer to receive reply into. |
return | bool |
public SetBrickName ( string deviceName ) : bool | ||
deviceName | string | Device name to set for the brick. |
return | bool |
public SetMotorState ( Motor motor, MotorState state ) : bool | ||
motor | Motor | Motor to set state for. |
state | MotorState | Motor's state to set. |
return | bool |
public SetMotorState ( Motor motor, MotorState state, bool waitReply ) : bool | ||
motor | Motor | Motor to set state for. |
state | MotorState | Motor's state to set. |
waitReply | bool | Wait reply from NXT (safer option) or not (faster option). |
return | bool |
public SetSensorMode ( Sensor sensor, SensorType type, SensorMode mode ) : bool | ||
sensor | Sensor | Sensor to set type of. |
type | SensorType | Sensor's type. |
mode | SensorMode | Sensor's mode. |
return | bool |
public SetSensorMode ( Sensor sensor, SensorType type, SensorMode mode, bool waitReply ) : bool | ||
sensor | Sensor | Sensor to set type of. |
type | SensorType | Sensor's type. |
mode | SensorMode | Sensor's mode. |
waitReply | bool | Wait reply from NXT (safer option) or not (faster option). |
return | bool |