DroidScript wiki

(was AndroidScript) unofficial documentation by the community

User Tools

Site Tools


Sidebar

Privacy Policy

News

Version1.42 is out since December 2nd 2016


Frequently Asked Questions


Namespaces

Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax

built_in:nxt_drive

Drive

The Drive function commands the NXT brick to drive one or more of it's motors with a given power and number of rotations.

The motors parameter can be a single motor, for example just “A” or a combination of motors such as “ABC”.

Power is given as a percentage value and negative values make the motor reverse.

If the number of rotations is set to zero, then the motor will continue until the Stop function is called.

nxt.Drive( motors, power, rotations );

Example - Drive forward 3 rotations

function OnStart()
{
  nxt = app.CreateNxt();
  app.SetMenu( "Connect,Drive" );
}
 
function OnMenu( name )
{
  if( name=="Connect" )
    nxt.ShowDevices();
  else if( name=="Drive" )
    nxt.Drive( "BC", 80, 3 );
}
built_in/nxt_drive.txt · Last modified: 2015/03/09 15:50 by octazid