APIs, concepts, guides, and more

◆ StreamingOutputAdd() [4/4]

void StreamingOutputAdd ( RapidCode::IOPoint * point,
bool on,
int32_t ptPointIndex )
Description:
Sets the state of the passed IOPoint to high (true) or low (false) once the controller reaches the specified point index.
Parameters
pointThe IOPoint to turn on or off.
onThe value to set the output to. true=>high, false=>low
ptPointIndexThe MotionElementExecutingID at which to set the output. The valid range is from 0 to the last point index of the currently executing streaming move.

Part of the Streaming Motion method group.

Sample Code:
IO: Input & Output
const int TOTAL_POINTS = 4; // total number of points
const int EMPTY_CT = -1; // number of points that remains in buffer before e-stop
const int OUTPUT_INDEX = 0; // digital output index that will be controlled
const int NODE_INDEX = 0; // the EtherCAT Node index
double[] positions = [1.0, 2.0, 3.0, 4.0]; // streaming motion positions
double[] times = [0.5, 0.1, 0.2, 0.4]; // streaming motion times
int outputEnableID = 2; // motion element ID at which to set output HIGH
int outputDisableID = 3; // motion element ID at which to set output LOW
// create IOPoint for digital output
IOPoint output0 = IOPoint.CreateDigitalOutput(controller.NetworkNodeGet(NODE_INDEX), OUTPUT_INDEX);
output0.Set(false); // set output low initially
// enable streaming/sync outputs
// configure sync outputs - turn output HIGH at motion element 2, LOW at motion element 3
axis.StreamingOutputAdd(output0, true, outputEnableID); // turn output HIGH at element ID 2
axis.StreamingOutputAdd(output0, false, outputDisableID); // turn output LOW at element ID 3
Console.WriteLine($"Starting streaming motion with {TOTAL_POINTS} points");
Console.WriteLine($"Output will go HIGH at element ID {outputEnableID}");
Console.WriteLine($"Output will go LOW at element ID {outputDisableID}");
// start streaming motion
axis.MovePT(RSIMotionType.RSIMotionTypePT, positions, times, TOTAL_POINTS, EMPTY_CT, false, true);
// monitor motion and output state
while (!axis.MotionDoneGet())
{
int currentElement = axis.MotionIdExecutingGet();
bool outputState = output0.Get();
Console.WriteLine($"Motion Element: {currentElement}, Output State: {outputState}");
Thread.Sleep(50); // small delay to avoid overwhelming console
}
See also
StreamingOutputsEnableSet, StreamingOutputsClear, StreamingOutputAdd, MotionIdExecutingGet, MotionElementIdExecutingGet, IO, IOPoint