Functions | |
void | motor_init (void) |
void | motor_set_vel (uint8_t motor, int16_t vel) |
void | motor_brake (uint8_t motor) |
uint16_t | motor_get_current (uint8_t motor) |
uint16_t | motor_get_current_MA (uint8_t motor) |
Each motor port has a current sensor associated with it, allowing the robot to sense the current usage of each motor. Motor current increases proportional to torque and thus can be used to sense when a motor has stalled (driving into a wall, other robots, etc).
void motor_brake | ( | uint8_t | motor | ) |
Set a motor to brake (stops the motor as quickly as possible). Calling motorSetVel() again will disable the brake state.
motor | Motor port to brake. |
uint16_t motor_get_current | ( | uint8_t | motor | ) |
Read the current in a given motor.
motor | Motor to sense current of. |
uint16_t motor_get_current_MA | ( | uint8_t | motor | ) |
Read the current in a given motor in milliamps.
motor | Motor to sense current of. |
void motor_init | ( | void | ) |
Initialize motors. Should not be called by user.
void motor_set_vel | ( | uint8_t | motor, | |
int16_t | vel | |||
) |
Set the motor velocity of a specific motor. The sign of 'vel' determines direction. A value of 0 sets the motor to coast.
motor | Motor port to set. | |
vel | Velocity to set motor 'motor'. |