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/03 08:12] madlyr [Methods] Added IsConnected() |
built_in:nxt [2015/03/21 18:13] madlyr [Methods] |
||
---|---|---|---|
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 |
- | ===== Create | + | ===== Description |
- | Create an NXT object using the CreateNxt function of the app object: | + | Create an NXT object using the **CreateNxt** function of the **[[built_in: |
< | < | ||
===== Methods ===== | ===== Methods ===== | ||
- | ^Method ^Description ^ | + | ^ Method |
- | |Beep(frequency, | + | | [[nxt_beep|Beep(frequency, |
- | |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)]] |
- | |CheckConnection() |Returns true if the NXT brick is currently connected to the phone/ | + | | [[nxt_checkconnection|CheckConnection()]] |
- | |Disconnect() |Disconnects the Bluetooth link between your phone and the NXT brick. | | + | | [[nxt_connect|Connect( p1 )]] | Connect |
- | |Drive(motors, | + | | |
- | |GetCurrentProgram() |Gets the name of the NXT-G program currently running on the NXT brick. | | + | | [[nxt_disconnect|Disconnect()]] |
- | |IsBluetoothEnabled() |Checks if Bluetooth is enabled on the phone/ | + | | [[nxt_drive|Drive(motors, |
- | |IsConnected() |Returns true if the NXT brick is currently connected to the phone/ | + | | [[nxt_filefindfirst|FileFindFirst( p1 )]] | FileFindFirst |
- | |IsMotorIdle(motor) |Checks if the specified **motor** (" | + | | |
- | |PlaySoundFile(file, | + | | [[nxt_filefindnext|FileFindNext( p1 )]] | FileFindNext |
- | |ReadColorSensor(input, | + | | |
- | |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_getbtaddress|GetBtAddress(obj)]] |
- | |ReadMail(mailbox, | + | | [[nxt_getbtname|GetBtName(obj)]] |
- | |ReadLightSensor(input, | + | | [[nxt_getcurrentprogram|GetCurrentProgram()]] |
- | |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_isbluetoothenabled|IsBluetoothEnabled()]] |
- | |ReadSoundSensor(input, | + | | [[nxt_isconnected|IsConnected()]] |
- | |SendMail(mailbox, | + | | IsEnabled() |
- | |SetInvert(boolean) |Provides a convenient way to invert the direction of the motor commands. | | + | | [[nxt_ismotoridle|IsMotorIdle(motor)]] | Checks if the specified **motor** (" |
- | |SetLampColor(input, | + | | [[nxt_playsoundfile|PlaySoundFile(file, |
- | |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_readcolorsensor|ReadColorSensor(input, |
- | |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_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). |
- | |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_readmail|ReadMail(mailbox, |
- | |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_readlightsensor|ReadLightSensor(input, |
- | |StopProgram() |Stops the NXT-G program (.rxe file) which is currently running on the NXT brick. | | + | | [[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_readsoundsensor|ReadSoundSensor(input, | ||
+ | | [[nxt_requestenable|RequestEnable()]] | ||
+ | | [[nxt_sendmail|SendMail(mailbox, | ||
+ | | [[nxt_setinvert|SetInvert(boolean)]] | Provides a convenient way to invert the direction of the motor commands. | ||
+ | | [[nxt_setlampcolor|SetLampColor(input, | ||
+ | | [[nxt_setonconnect|SetOnConnect(myfunc)]] | ||
+ | | [[nxt_setonconnected|SetOnConnected(myfunc)]] | ||
+ | | [[nxt_showdevices|ShowDevices()]] | ||
+ | | [[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_stop|Stop(motors)]] | ||
+ | | [[nxt_stopprogram|StopProgram()]] | ||
+ | | ToColorName(colorNum) |