Overview   Project   Class   Tree   Index 
NXT C++ Bluetooth Library
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD

NXT C++ Bluetooth Library
Class Motor

   in motor.h
   in motor.cpp

class Motor

Class for the NXT motors


Constructor Summary
Motor( Motor_port port, Connection* connection )
          
 
Method Summary
 Motor_port get_port()
          Get the motor port
 long int get_rotation()
          Get the position of the motor
 bool is_running()
          Is the motor running
 void move_to( char speed, long int target, int tolerance )
          Move to a target degree - function will return when the motor is done moving (this is experimental)
 void off( bool reply = false )
          Make the motor coast
 void on( char speed, unsigned int degrees = 0, bool reply = false )
          Make the motor turn
 void reset_rotation( bool reply = false )
          Reset the position of the motor
 void stop( bool reply = false )
          Brings the motor to a full stop
 

Constructor Detail

Motor

public Motor( Motor_port port, Connection* connection );
Parameters:
port - [which motor port to use]
*connection - [attach a connection]


Method Detail

get_port

public Motor_port get_port();
Get the motor port
Returns:
the motor port

get_rotation

public long int get_rotation();
Get the position of the motor
Returns:
the position of the motor

is_running

public bool is_running();
Is the motor running
Returns:
true if the motor is running otherwise false

move_to

public void move_to( char speed, long int target, int tolerance );
Move to a target degree - function will return when the motor is done moving (this is experimental)
Parameters:
speed - [set the speed of the motor (the sign has no influence)]
target - [set the target degree]
tolerance - [allow some torance to avoid hanging the function (don't set this below 4)]

off

public void off( bool reply = false );
Make the motor coast
Parameters:
reply - [true = require reply from NXT; false = no reply from NXT]

on

public void on( char speed, unsigned int degrees = 0, bool reply = false );
Make the motor turn
Parameters:
speed - [set the speed of the motor (the sign will determine the direction of the motor)]
degree - [makes the motor turn x degrees (if set to zero the motor will turn forever)]
reply - [true = require reply from NXT; false = no reply from NXT]

reset_rotation

public void reset_rotation( bool reply = false );
Reset the position of the motor
Parameters:
reply - [true = require reply from NXT; false = no reply from NXT]

stop

public void stop( bool reply = false );
Brings the motor to a full stop
Parameters:
reply - [true = require reply from NXT; false = no reply from NXT]

 Overview   Project   Class   Tree   Index 
NXT C++ Bluetooth Library
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD