LEGO MINDSTORMSコンポーネント

Table of Contents:

Ev3ColorSensor

EV3 component icon

A component that provides a high-level interface to a color sensor on a LEGO MINDSTORMS EV3 robot.

Properties

AboveRangeEventEnabledSpecifies whether the AboveRange event should fire when the light level goes above the TopOfRange.BelowRangeEventEnabledSpecifies whether the BelowRange event should fire when the light level goes below the BottomOfRange.BluetoothClientSpecifies the BluetoothClient component that should be used for communication. Must be set in the Designer.BottomOfRangeSpecifies the bottom of the range used for the BelowRange, WithinRange, and AboveRange events.ColorChangedEventEnabledSpecifies whether the ColorChanged event should fire when the DetectColor property is set to True and the detected color changesModeThe current mode of the sensor. One of: Reflected: Senses the current light level including light reflected by the sensor. Ambient: Senses the current light level not including light reflected by the sensor. Color: Senses the color the sensor is pointing at.SensorPortSpecifies the sensor port that the sensor is connected to. Must be set in the Designer.TopOfRangeSpecifies the top of the range used for the BelowRange, WithinRange, and AboveRange events.WithinRangeEventEnabledSpecifies whether the WithinRange event should fire when the light level goes between the BottomOfRange and the TopOfRange.

Events

AboveRange()Light level has gone above the range.BelowRange()Light level has gone below the range.ColorChanged(colorCode,colorName)Called when the detected color has changed.WithinRange()Light level has gone within the range.

Methods

 GetColorCode()It returns the color code for the detected color. GetColorName()Returns the name of the detected color. GetLightLevel()It returns the light level in percentage.

Ev3Commands

EV3 component icon

A component that provides a low-level interface to a LEGO MINDSTORMS EV3 robot, with functions to send system or direct commands to EV3 robots.

Properties

BluetoothClientSpecifies the BluetoothClient component that should be used for communication. Must be set in the Designer.

Events

None

Methods

 GetBatteryCurrent()Get the battery current. GetBatteryVoltage()Get the battery voltage. GetFirmwareBuild()Get the firmware build on EV3. GetFirmwareVersion()Get the firmware version on EV3. GetHardwareVersion()Get the hardware version of EV3. GetOSBuild()Get the OS build on EV3. GetOSVersion()Get the OS version on EV3.KeepAlive(minutes)Keep the EV3 brick from shutdown for a period of time.

Ev3GyroSensor

EV3 component icon

A component that provides a high-level interface to a gyro sensor on a LEGO MINDSTORMS EV3 robot.

Properties

BluetoothClientSpecifies the BluetoothClient component that should be used for communication. Must be set in the Designer.ModeReturns the mode of the sensor.SensorPortSpecifies the sensor port that the sensor is connected to. Must be set in the Designer.SensorValueChangedEventEnabledReturns whether the SensorValueChanged event should fire when the sensor value changed.

Events

SensorValueChanged(sensorValue)Called then the sensor value changed.

Methods

 GetSensorValue()Returns the current angle or rotation speed based on current mode, or -1 if the value cannot be read from sensor.

Ev3Motors

EV3 component icon

A component that provides both high- and low-level interfaces to control the motors on LEGO MINDSTORMS EV3.

Properties

BluetoothClientSpecifies the BluetoothClient component that should be used for communication. Must be set in the Designer.EnableSpeedRegulationReturns whether to keep motor rotation at constant speed.MotorPortsSpecifies the motor port.ReverseDirectionReturns if the direction of the motors is reversed.StopBeforeDisconnectSpecifies whether to stop the drive motors before disconnecting.TachoCountChangedEventEnabledReturns whether the TachoCountChanged event should fire when the motor angle is increaing.WheelDiameterReturns the diameter of the wheels attached on motors.

Events

TachoCountChanged(tachoCount)Called when the tacho count has changed.

Methods

 GetTachoCount()Get the current tacho count.ResetTachoCount()Set the current tacho count to zero.RotateInDistance(power,distance,useBrake)Rotate the motors in a distance.RotateInDuration(power,milliseconds,useBrake)Rotate the motors in a period of time.RotateInTachoCounts(power,tachoCounts,useBrake)Rotate the motors in a number of tacho counts.RotateIndefinitely(power)Start to rotate the motors.RotateSyncInDistance(power,distance,turnRatio,useBrake)Rotate the motors at the same speed for a distance in cm.RotateSyncInDuration(power,milliseconds,turnRatio,useBrake)Rotate the motors at the same speed in a period of time.RotateSyncInTachoCounts(power,tachoCounts,turnRatio,useBrake)Rotate the motors at the same speed in a number of tacho counts.RotateSyncIndefinitely(power,turnRatio)Start to rotate the motors at the same speed.Stop(useBrake)Stop the motors of the robot.ToggleDirection()Toggle the direction of motors.

Ev3Sound

EV3 component icon

A component that provides a high-level interface to a LEGO MINDSTORMS EV3 robot, which provides sound functionalities.

Properties

BluetoothClientSpecifies the BluetoothClient component that should be used for communication. Must be set in the Designer.

Events

None

Methods

PlayTone(volume,frequency,milliseconds)Make the robot play a tone.StopSound()Stop any sound on the robot.

Ev3TouchSensor

EV3 component icon

A component that provides a high-level interface to a touch sensor on a LEGO MINDSTORMS EV3 robot.

Properties

BluetoothClientSpecifies the BluetoothClient component that should be used for communication. Must be set in the Designer.PressedEventEnabledReturns whether the Pressed event should fire when the touch sensor is pressed.ReleasedEventEnabledSpecifies whether the Released event should fire when the touch sensor is released.SensorPortSpecifies the sensor port that the sensor is connected to. Must be set in the Designer.

Events

Pressed()Called when the touch sensor is pressed.Released()Called when the touch sensor is pressed.

Methods

 IsPressed()Returns true if the touch sensor is pressed.

Ev3UI

EV3 component icon

A component that provides a high-level interface to a LEGO MINDSTORMS EV3 robot, which provides graphic functionalities.

Properties

BluetoothClientSpecifies the BluetoothClient component that should be used for communication. Must be set in the Designer.

Events

None

Methods

DrawCircle(color,x,y,radius,fill)Draw a circle on the screen.DrawIcon(color,x,y,type,no)Draw a built-in icon on screen.DrawLine(color,x1,y1,x2,y2)Draw a line on the screen.DrawPoint(color,x,y)Draw a point on the screen.DrawRect(color,x,y,width,height,fill)Draw a rectangle on the screen.FillScreen(color)Fill the screen with a color.

Ev3UltrasonicSensor

EV3 component icon

A component that provides a high-level interface to an ultrasonic sensor on a LEGO MINDSTORMS EV3 robot.

Properties

AboveRangeEventEnabledSpecifies whether the AboveRange event should fire when the distance goes above the TopOfRange.BelowRangeEventEnabledSpecifies whether the BelowRange event should fire when the distance goes below the BottomOfRange.BluetoothClientSpecifies the BluetoothClient component that should be used for communication. Must be set in the Designer.BottomOfRangeSpecifies the bottom of the range used for the BelowRange, WithinRange, and AboveRange events.SensorPortSpecifies the sensor port that the sensor is connected to. Must be set in the Designer.TopOfRangeSpecifies the top of the range used for the BelowRange, WithinRange, and AboveRange events.UnitReturns the unit of distance.WithinRangeEventEnabledSpecifies whether the WithinRange event should fire when the distance goes between the BottomOfRange and the TopOfRange.

Events

AboveRange()Called when the detected distance has gone above the range.BelowRange()Called when the detected distance has gone below the range.WithinRange()Called when the detected distance has gone within the range.

Methods

 GetDistance()Returns the current distance in centimeters as a value between 0 and 254, or -1 if the distance can not be read.

NxtColorSensor

NXT component icon

A component that provides a high-level interface to a color sensor on a LEGO MINDSTORMS NXT robot.

Properties

AboveRangeEventEnabledSpecifies whether the AboveRange event should fire when the DetectColor property is set to False and the light level goes above the TopOfRange.BelowRangeEventEnabledSpecifies whether the BelowRange event should fire when the DetectColor property is set to False and the light level goes below the BottomOfRange.BluetoothClientSpecifies the BluetoothClient component that should be used for communication. Must be set in the Designer.BottomOfRangeSpecifies the bottom of the range used for the BelowRange, WithinRange, and AboveRange events.ColorChangedEventEnabledSpecifies whether the ColorChanged event should fire when the DetectColor property is set to True and the detected color changesDetectColorSpecifies whether the sensor should detect color light. True indicates that the sensor should detect color; False indicates that the sensor should detect light.GenerateColorSpecifies the color that should generated by the sensor. Only None, Red, Green, or Blue are valid values. The sensor will not generate color when the DetectColor property is set to True.SensorPortSpecifies the sensor port that the sensor is connected to. Must be set in the Designer.TopOfRangeSpecifies the top of the range used for the BelowRange, WithinRange, and AboveRange events.WithinRangeEventEnabledSpecifies whether the WithinRange event should fire when the DetectColor property is set to False and the light level goes between the BottomOfRange and the TopOfRange.

Events

AboveRange()Light level has gone above the range. The AboveRange event will not occur if the DetectColor property is set to True or if the AboveRangeEventEnabled property is set to False.BelowRange()Light level has gone below the range. The BelowRange event will not occur if the DetectColor property is set to True or if the BelowRangeEventEnabled property is set to False.ColorChanged(color)Detected color has changed. The ColorChanged event will not occur if the DetectColor property is set to False or if the ColorChangedEventEnabled property is set to False.WithinRange()Light level has gone within the range. The WithinRange event will not occur if the DetectColor property is set to True or if the WithinRangeEventEnabled property is set to False.

Methods

 GetColor()Returns the current detected color, or the color None if the color can not be read or if the DetectColor property is set to False. GetLightLevel()Returns the current light level as a value between 0 and 1023, or -1 if the light level can not be read or if the DetectColor property is set to True.

NxtDirectCommands

NXT component icon

A component that provides a low-level interface to a LEGO MINDSTORMS NXT robot, with functions to send NXT Direct Commands.

Properties

BluetoothClientSpecifies the BluetoothClient component that should be used for communication. Must be set in the Designer.

Events

None

Methods

DeleteFile(fileName)Delete a file on the robot.DownloadFile(source,destination)Download a file to the robot.

See MediaUtil’s determineMediaSource for information about what a path can be. GetBatteryLevel()Get the battery level for the robot. Returns the voltage in millivolts. GetBrickName()Get the brick name of the robot. GetCurrentProgramName()Get the name of currently running program on the robot. GetFirmwareVersion()Get the firmware and protocol version numbers for the robot as a list where the first element is the firmware version number and the second element is the protocol version number. GetInputValues(sensorPortLetter)Reads the values of an input sensor on the robot. Assumes sensor type has been configured via SetInputMode. GetOutputState(motorPortLetter)Reads the output state of a motor on the robot. KeepAlive()Keep Alive. Returns the current sleep time limit in milliseconds. ListFiles(wildcard)Returns a list containing the names of matching files found on the robot. LsGetStatus(sensorPortLetter)Returns the count of available bytes to read. LsRead(sensorPortLetter)Reads unsigned low speed data from an input sensor on the robot. Assumes sensor type has been configured via SetInputMode.LsWrite(sensorPortLetter,list,rxDataLength)Writes low speed data to an input sensor on the robot. Assumes sensor type has been configured via SetInputMode. MessageRead(mailbox)Read a message from a mailbox (1-10) on the robot.MessageWrite(mailbox,message)Write a message to a mailbox (1-10) on the robot.PlaySoundFile(fileName)Play a sound file on the robot.PlayTone(frequencyHz,durationMs)Make the robot play a tone.ResetInputScaledValue(sensorPortLetter)Reset the scaled value of an input sensor on the robot.ResetMotorPosition(motorPortLetter,relative)Reset motor position.SetBrickName(name)Set the brick name of the robot.SetInputMode(sensorPortLetter,sensorType,sensorMode)Configure an input sensor on the robot.SetOutputState(motorPortLetter,power,mode,regulationMode,turnRatio,runState,tachoLimit)Sets the output state of a motor on the robot.StartProgram(programName)Start execution of a previously downloaded program on the robot.StopProgram()Stop execution of the currently running program on the robot.StopSoundPlayback()Stop sound playback.

NxtDrive

NXT component icon

A component that provides a high-level interface to a LEGO MINDSTORMS NXT robot, with functions that can move and turn the robot.

Properties

BluetoothClientSpecifies the BluetoothClient component that should be used for communication. Must be set in the Designer.DriveMotorsSpecifies the motor ports that are used for driving.StopBeforeDisconnectSpecifies whether to stop the drive motors before disconnecting.WheelDiameterReturns the diameter of the wheels used for driving.

Events

None

Methods

MoveBackward(power,distance)Move the robot backward the given distance, with the specified percentage of maximum power, by powering both drive motors backward.MoveBackwardIndefinitely(power)Move the robot backward indefinitely, with the specified percentage of maximum power, by powering both drive motors backward.MoveForward(power,distance)Move the robot forward the given distance, with the specified percentage of maximum power, by powering both drive motors forward.MoveForwardIndefinitely(power)Move the robot forward indefinitely, with the specified percentage of maximum power, by powering both drive motors forward.Stop()Stop the drive motors of the robot.TurnClockwiseIndefinitely(power)Turn the robot clockwise indefinitely, with the specified percentage of maximum power, by powering the left drive motor forward and the right drive motor backward.TurnCounterClockwiseIndefinitely(power)Turn the robot counterclockwise indefinitely, with the specified percentage of maximum power, by powering the right drive motor forward and the left drive motor backward.

NxtLightSensor

NXT component icon

A component that provides a high-level interface to a light sensor on a LEGO MINDSTORMS NXT robot.

Properties

AboveRangeEventEnabledSpecifies whether the AboveRange event should fire when the light level goes above the TopOfRange.BelowRangeEventEnabledSpecifies whether the BelowRange event should fire when the light level goes below the BottomOfRange.BluetoothClientSpecifies the BluetoothClient component that should be used for communication. Must be set in the Designer.BottomOfRangeSpecifies the bottom of the range used for the BelowRange, WithinRange, and AboveRange events.GenerateLightSpecifies whether the light sensor should generate light.SensorPortSpecifies the sensor port that the sensor is connected to. Must be specified in the Designer.TopOfRangeSpecifies the top of the range used for the BelowRange, WithinRange, and AboveRange events.WithinRangeEventEnabledSpecifies whether the WithinRange event should fire when the light level goes between the BottomOfRange and the TopOfRange.

Events

AboveRange()Light level has gone above the range.BelowRange()Light level has gone below the range.WithinRange()Light level has gone within the range.

Methods

 GetLightLevel()Returns the current light level as a value between 0 and 1023, or -1 if the light level can not be read.

NxtSoundSensor

NXT component icon

A component that provides a high-level interface to a sound sensor on a LEGO MINDSTORMS NXT robot.

Properties

AboveRangeEventEnabledSpecifies whether the AboveRange event should fire when the sound level goes above the TopOfRange.BelowRangeEventEnabledSpecifies whether the BelowRange event should fire when the sound level goes below the BottomOfRange.BluetoothClientSpecifies the BluetoothClient component that should be used for communication. Must be set in the Designer.BottomOfRangeSpecifies the bottom of the range used for the BelowRange, WithinRange, and AboveRange events.SensorPortSpecifies the sensor port that the sensor is connected to. Must be set in the Designer.TopOfRangeSpecifies the top of the range used for the BelowRange, WithinRange, and AboveRange events.WithinRangeEventEnabledSpecifies whether the WithinRange event should fire when the sound level goes between the BottomOfRange and the TopOfRange.

Events

AboveRange()Sound level has gone above the range.BelowRange()Sound level has gone below the range.WithinRange()Sound level has gone within the range.

Methods

 GetSoundLevel()Returns the current sound level as a value between 0 and 1023, or -1 if the sound level can not be read.

NxtTouchSensor

NXT component icon

A component that provides a high-level interface to a touch sensor on a LEGO MINDSTORMS NXT robot.

Properties

BluetoothClientSpecifies the BluetoothClient component that should be used for communication. Must be set in the Designer.PressedEventEnabledSpecifies whether the Pressed event should fire when the touch sensor is pressed.ReleasedEventEnabledSpecifies whether the Released event should fire when the touch sensor is released.SensorPortSpecifies the sensor port that the sensor is connected to. Must be set in the Designer.

Events

Pressed()Touch sensor has been pressed.Released()Touch sensor has been released.

Methods

 IsPressed()Returns true if the touch sensor is pressed.

NxtUltrasonicSensor

NXT component icon

A component that provides a high-level interface to an ultrasonic sensor on a LEGO MINDSTORMS NXT robot.

Properties

AboveRangeEventEnabledSpecifies whether the AboveRange event should fire when the distance goes above the TopOfRange.BelowRangeEventEnabledSpecifies whether the BelowRange event should fire when the distance goes below the BottomOfRange.BluetoothClientSpecifies the BluetoothClient component that should be used for communication. Must be set in the Designer.BottomOfRangeSpecifies the bottom of the range used for the BelowRange, WithinRange, and AboveRange events.SensorPortSpecifies the sensor port that the sensor is connected to. Must be set in the Designer.TopOfRangeSpecifies the top of the range used for the BelowRange, WithinRange, and AboveRange events.WithinRangeEventEnabledSpecifies whether the WithinRange event should fire when the distance goes between the BottomOfRange and the TopOfRange.

Events

AboveRange()Distance has gone above the range.BelowRange()Distance has gone below the range.WithinRange()Distance has gone within the range.

Methods

 GetDistance()Returns the current distance in centimeters as a value between 0 and 254, or -1 if the distance can not be read.

This page is hosted by TM Software, Inc.
and based on the work by Massachusetts Institute of Technology
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License