AStar32U4 library
|
Controls motor speed and direction on the A-Star 32U4 Robot Controller. More...
#include <AStar32U4Motors.h>
Static Public Member Functions | |
static void | flipM1 (bool flip) |
Flips the direction of motor 1. More... | |
static void | flipM2 (bool flip) |
Flips the direction of motor 2. More... | |
static void | setM1Speed (int16_t speed) |
Sets the speed for motor 1. More... | |
static void | setM2Speed (int16_t speed) |
Sets the speed for motor 2. More... | |
static void | setSpeeds (int16_t m2Speed, int16_t m1Speed) |
Sets the speed for both motors. More... | |
Controls motor speed and direction on the A-Star 32U4 Robot Controller.
By default, positive speed arguments ("forward") correspond to current flowing from motor driver output A to B, while negative speed arguments ("reverse") correspond to current flowing from B to A. Calling flipM1() or flipM2() with an argument of true
flips the correspondence for that motor (that is, it flips the meaning of "forward" and "reverse").
This library uses Timer 1, so it will conflict with any other libraries using that timer.
Definition at line 20 of file AStar32U4Motors.h.
|
static |
Flips the direction of motor 1.
You can call this function with an argument of true
if you want to flip the effect that positive and negative speeds have on the direction of motor 1.
flip | If true, then positive motor speeds will correspond to current flowing from B to A. If false, then positive motor speeds will correspond to current flowing from A to B. |
Definition at line 39 of file AStar32U4Motors.cpp.
|
static |
Flips the direction of motor 2.
You can call this function with an argument of true
if you want to flip the effect that positive and negative speeds have on the direction of motor 2.
flip | If true, then positive motor speeds will correspond to current flowing from B to A. If false, then positive motor speeds will correspond to current flowing from A to B. |
Definition at line 45 of file AStar32U4Motors.cpp.
|
static |
Sets the speed for motor 1.
speed | A number from -400 to 400 representing the speed and direction of motor 1. Values of -400 or less result in full speed reverse, and values of 400 or more result in full speed forward. |
Definition at line 51 of file AStar32U4Motors.cpp.
|
static |
Sets the speed for motor 2.
speed | A number from -400 to 400 representing the speed and direction of motor 2. Values of -400 or less result in full speed reverse, and values of 400 or more result in full speed forward. |
Definition at line 73 of file AStar32U4Motors.cpp.
|
static |
Sets the speed for both motors.
m1Speed | A number from -400 to 400 representing the speed and direction of motor 1. Values of -400 or less result in full speed reverse, and values of 400 or more result in full speed forward. |
m2Speed | A number from -400 to 400 representing the speed and direction of motor 2. Values of -400 or less result in full speed reverse, and values of 400 or more result in full speed forward. |
Definition at line 95 of file AStar32U4Motors.cpp.