Description Function Coding Example (for controller ID = 1)
Set DC Motor Speed
Uses velocity PID control to set the
constant speed of a TETRIX DC Motor
with a TETRIX motor encoder installed.
The speed parameter range is 0 to 720
degrees per second (DPS). The sign
(+/-) of the speed parameter controls
direction of rotation.
setMotorSpeed(ID#, motor#, speed);
Data Type:
ID# = integer
motor# = integer
speed = integer
Data Range:
motor# = 1 or 2
speed = -720 to 720
setMotorSpeed(1, 1, 360);
Spin Motor 1 clockwise at a constant
speed of 360 DPS.
setMotorSpeed(1, 1, -360);
Spin Motor 1 counterclockwise at a
constant speed of 360 DPS.
Set DC Motor Speeds
Uses velocity PID control to
simultaneously set the constant
speeds of both TETRIX DC Motor
channels with TETRIX motor encoders
installed. Both Motor 1 and Motor
2 channel parameters are set with a
single statement. The speed parameter
range is 0 to 720 degrees per second
(DPS). The sign (+/-) of the speed
parameter controls direction of
rotation.
setMotorSpeeds(ID#, speed1,
speed2);
Data Type:
ID# = integer
speed1 = integer
speed2 = integer
Data Range:
speed1 = -720 to 720
speed2 = -720 to 720
setMotorSpeeds(1, 360, 360);
Spin Motor 1 and Motor 2 clockwise at a
constant speed of 360 DPS.
setMotorSpeeds(1, 360, -360);
Spin Motor 1 clockwise and Motor 2
counterclockwise at a constant speed of
360 DPS.
setMotorSpeeds(1, 180, -180);
Spin Motor 1 clockwise and Motor 2
counterclockwise at a constant speed of
180 DPS.
Set DC Motor Target
Implements velocity and positional
PID control to set the constant speed
and the encoder count target holding
position of a TETRIX DC Motor with a
TETRIX encoder installed. The speed
parameter range is 0 to 720 degrees
per second (DPS). The encoder count
target position is a signed long integer
from -2,147,483,648 to 2,147,483,647.
Each encoder count = 1/4-degree
resolution.
setMotorTarget(ID#, motor#, speed,
target);
Data Type:
ID# = integer
motor# = integer
speed = integer
target = long
Data Range:
motor# = 1 or 2
speed = 0 to 720
target = -2147483648 to 2147483647
setMotorTarget(1, 1, 360, 1440);
Spin Motor 1 at a constant speed of 360
DPS until encoder 1 count equals 1,440.
When at encoder target count, hold
position in a servo-like mode.
setMotorTarget(1, 2, 180, -1440);
Spin Motor 2 at a constant speed of 180
DPS until encoder 2 count equals -1,440 (1
revolution). When at encoder target count,
hold position in a servo-like mode.