DroidScript wiki

(was AndroidScript) unofficial documentation by the community

User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

built_in:nxt_drive [2015/03/09 15:50] (current)
octazid created
Line 1: Line 1:
 +====== 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.
 +<​code>​nxt.Drive( motors, power, rotations );</​code>​
 +====Example - Drive forward 3 rotations====
 +<code javascript>​
 +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