Data Sheet

Core Spartan Documentation Modern Robotics, Inc
Version 3.0.3 Page 27
void motorMode(unsigned char motor, unsigned char mode)
This function sets the mode for the motor(s). The parameter motor refers to the
motor(s) that will experience the change in state. The parameter mode refers to
the way the motor(s) will function. In FLOAT mode, the motor is able to coast to
a stop at a speed value of 0, unlocking the motor allowing it to spin freely. In
BRAKE mode, the motor is halted at a speed value of 0, locking the motor to that
position.
Constants
Definition
FLOAT
Coasts to stop on speed value of 0 (unlocked)
BRAKE
Halted on speed value of 0 (locked)
M0
Reference to Motor 0
M1
Reference to Motor 1
CORE.motorMode(CORE.M0, CORE.FLOAT);
…or…
CORE.motorMode(CORE.M0+ CORE.M1, CORE.BRAKE);
void motorSpeed(unsigned char motor, int speed)
This function sets the speed for the motor(s). The parameter motors refers to
the motor that will experience the change in state. The parameter speed is an
integer value that ranges from -100 to 100 with 0 being motor stop. The sign of
speed determines the motor direction. Since Core Spartan Controller is using DC
motors, the DC motor connectors to the Core Spartan Controller can be flipped
around to reverse motor direction, allowing the user to maintain sign
convention.
With both motors connect to Core Spartan Controller with the same polarity,
moving in forward direction:
CORE.motorSpeed(CORE.M0,100);
CORE.motorSpeed(CORE.M1,-100);
With one motor connection flipped, moving in forward direction:
CORE.motorSpeed(CORE.M0+ CORE.M1,100);
…or…
CORE.motorSpeed(CORE.M0+ CORE.M1,-100);