This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
built_in:nxt [2015/03/10 08:02] madlyr [Methods] |
built_in:nxt [2015/03/21 17:48] madlyr [NXT control] |
||
---|---|---|---|
Line 2: | Line 2: | ||
- | The NXT object is used to manage the connection between your Android phone and the NXT brick. | + | The NXT object is used to manage the connection between your Android phone and the Lego Mindstorms |
===== Description ===== | ===== Description ===== | ||
Line 9: | Line 9: | ||
===== Methods ===== | ===== Methods ===== | ||
- | ^Method ^Description ^ | + | ^ Method |
- | |[[nxt_beep|Beep(frequency, | + | | [[nxt_beep|Beep(frequency, |
- | |[[nxt_brake|Brake(motors)]] |Commands the NXT brick to Brake one or more of it's motors.\\ The **motors** parameter can be a single motor, for example just " | + | | [[nxt_brake|Brake(motors)]] |
- | |[[nxt_checkconnection|CheckConnection()]] |Returns true if the NXT brick is currently connected to the phone/ | + | | [[nxt_checkconnection|CheckConnection()]] |
- | |[[nxt_disconnect|Disconnect()]] |Disconnects the Bluetooth link between your phone and the NXT brick. | | + | | [[nxt_disconnect|Disconnect()]] |
- | |[[nxt_drive|Drive(motors, | + | | [[nxt_drive|Drive(motors, |
- | |[[nxt_getcurrentprogram|GetCurrentProgram()]] |Gets the name of the NXT-G program currently running on the NXT brick. | | + | | [[nxt_getbtaddress|GetBtAddress(obj)]] |
- | |[[nxt_isbluetoothenabled|IsBluetoothEnabled()]] |Checks if Bluetooth is enabled on the phone/ | + | | [[nxt_getbtname|GetBtName(obj)]] |
- | |IsConnected() |Returns true if the NXT brick is currently connected to the phone/ | + | | [[nxt_getcurrentprogram|GetCurrentProgram()]] |
- | |IsEnabled() |Checks if Bluetooth is enabled on the phone/ | + | | [[nxt_isbluetoothenabled|IsBluetoothEnabled()]] |
- | |[[nxt_ismotoridle|IsMotorIdle(motor)]] |Checks if the specified **motor** (" | + | | [[nxt_isconnected|IsConnected()]] |
- | |[[nxt_playsoundfile|PlaySoundFile(file, | + | | IsEnabled() |
- | |[[nxt_readcolorsensor|ReadColorSensor(input, | + | | [[nxt_ismotoridle|IsMotorIdle(motor)]] |
- | |[[nxt_readdistancesensor|ReadDistanceSensor(input)]] |Reads the distance measured by the ultrasonic sensor in centimeters.\\ The **input** parameter should be an NXT input port number between 1 and 4 (which the ultrasonic sensor is plugged into). | | + | | [[nxt_playsoundfile|PlaySoundFile(file, |
- | |[[nxt_readmail|ReadMail(mailbox, | + | | [[nxt_readcolorsensor|ReadColorSensor(input, |
- | |[[nxt_readlightsensor|ReadLightSensor(input, | + | | [[nxt_readdistancesensor|ReadDistanceSensor(input)]] |
- | |[[nxt_readtouchsensor|ReadTouchSensor(input)]] |Reads the state of the NXT touch sensor, which will be true if the switch is currently pushed in and false otherwise.\\ The **input** parameter should be an NXT input port number between 1 and 4 (which the touch sensor is plugged into). | | + | | [[nxt_readmail|ReadMail(mailbox, |
- | |[[nxt_readsoundsensor|ReadSoundSensor(input, | + | | [[nxt_readlightsensor|ReadLightSensor(input, |
- | |RequestEnable() |Invokes system dialog box which could enable Bluetooth on tablet/ | + | | [[nxt_readtouchsensor|ReadTouchSensor(input)]] |
- | |[[nxt_sendmail|SendMail(mailbox, | + | | [[nxt_readsoundsensor|ReadSoundSensor(input, |
- | |[[nxt_setinvert|SetInvert(boolean)]] |Provides a convenient way to invert the direction of the motor commands. | | + | | [[nxt_requestenable|RequestEnable()]] |
- | |[[nxt_setlampcolor|SetLampColor(input, | + | | [[nxt_sendmail|SendMail(mailbox, |
- | |[[nxt_setonconnected|SetOnConnected(myfunc)]] |Allows you to set the name of a function that you would like to be called when the NXT has been successfully connected via Bluetooth. | | + | | [[nxt_setinvert|SetInvert(boolean)]] |
- | |[[nxt_showdevices|ShowDevices()]] |Shows the user a dialog box that contains a list of NXT bricks which are paired with the phone. The user can then select the brick to connect to via Bluetooth. | | + | | [[nxt_setlampcolor|SetLampColor(input, |
- | |[[nxt_startprogram|StartProgram(program)]] |Starts an NXT-G **program** (.rxe file) on the NXT brick (if the program is available on the brick).\\ Note: This function will also launch .rso sound files. | | + | | [[nxt_setonconnect|SetOnConnect(myfunc)]] |
- | |[[nxt_stop|Stop(motors)]] |Commands the NXT brick to Stop powering one or more of it's motors and allow them to coast to a halt.\\ The **motors** parameter can be a single motor, for example just " | + | | [[nxt_setonconnected|SetOnConnected(myfunc)]] |
- | |[[nxt_stopprogram|StopProgram()]] |Stops the NXT-G program (.rxe file) which is currently running on the NXT brick. | | + | | [[nxt_showdevices|ShowDevices()]] |
- | |ToColorName(colorNum) |Function returns string with one of the six colors: black, blue, green, yellow, red, white converted from **colorNum** parameter.\\ You can use the ToColorName function to convert value obtained from color sensor by method [[nxt_readcolorsensor|ReadColorSensor]] with mode set to ColorDetect. | | + | | [[nxt_startprogram|StartProgram(program)]] |
+ | | [[nxt_stop|Stop(motors)]] | ||
+ | | [[nxt_stopprogram|StopProgram()]] | ||
+ | | ToColorName(colorNum) |