Motors

Functions for controlling the motors. Functions for controlling the motors. Found in motor.h. More...


Defines

#define FORWARD   1
 make the motors go forwards
#define BACKWARD   0
 make the motors go backwards

Functions

int motors_init (void)
 Initialize the motors.
int motor_l_set (int direction, int speed)
 Set speed and direction of left motor.
int motor_r_set (int direction, int speed)
 Set speed and direction of right motor.
int motor1_set (int direction, int speed)
 Set speed and direction of motor1.
int motor2_set (int direction, int speed)
 Set speed and direction of motor2.
int motors_off (void)
 Turn the motors off.

Variables

unsigned char motors_initd = 0


Detailed Description

Functions for controlling the motors. Functions for controlling the motors. Found in motor.h.

Function Documentation

int motor1_set ( int  direction,
int  speed 
)

Set speed and direction of motor1.

Sets the speed and direction of motor1. motors_init must be called before this function can be used.

Parameters:
direction Either FORWARD or BACKWARD to set the direction of rotation.
speed The speed the motor will run at, in the range 0-255.
Returns:
0 if init succesfull, an error code otherwise
See also:
motor2_set, motors_init
Deprecated:
use the left motor function instead. it's more intuitive and easier to read.

int motor2_set ( int  direction,
int  speed 
)

Set speed and direction of motor2.

Sets the speed and direction of motor2. motors_init must be called before this function can be used.

Parameters:
direction Either FORWARD or BACKWARD to set the direction of rotation.
speed The speed the motor will run at, in the range 0-255.
Returns:
0 if init succesfull, an error code otherwise
See also:
motor2_set, motors_init
Deprecated:
use the right motor function instead. it's more intuitive and easier to read.

int motor_l_set ( int  direction,
int  speed 
)

Set speed and direction of left motor.

Sets the speed and direction of the left motor. motors_init must be called before this function can be used.

Parameters:
direction Either FORWARD or BACKWARD to set the direction of rotation.
speed The speed the motor will run at, in the range 0-255.
Returns:
0 if init succesfull, an error code otherwise
See also:
motor_r_set, motors_init

int motor_r_set ( int  direction,
int  speed 
)

Set speed and direction of right motor.

Sets the speed and direction of the right motor. motors_init must be called before this function can be used.

Parameters:
direction Either FORWARD or BACKWARD to set the direction of rotation.
speed The speed the motor will run at, in the range 0-255.
Returns:
0 if init succesfull, an error code otherwise
See also:
motor_l_set, motors_init

int motors_init ( void   ) 

Initialize the motors.

Initializes both motors so that they can be used with future calls to motor1_set and motor2_set.

Returns:
0 if init succesfull, an error code otherwise
See also:
motors_off, motor1_set, motor2_set

int motors_off ( void   ) 

Turn the motors off.

Turns off both motors.

Returns:
0 if init succesfull, an error code otherwise
See also:
motors_init


Generated on Fri Nov 20 21:51:59 2009 for Colony by  doxygen 1.5.8