APIs, concepts, guides, and more

◆ CreateDigitalInput() [2/5]

IOPoint * CreateDigitalInput ( Axis * axis,
RSIMotorGeneralIo motorGeneralIoNumber )
static
Description:
Parameters
axis
motorGeneralIoNumber::RSIMotorGeneralIo
Returns
(IOPoint*) A pointer to the newly created IOPoint.

Part of the IOPoint Creation method group.

Sample Code:
IO: Input & Output
const int NODE_INDEX = 0; // the EtherCAT Node we will be communicating with
const int OUTPUT_INDEX = 0; // the PDO Index in that Node
// create IOPoint for digital output - automatically gets memory index of specified node and output index
IOPoint output0 = IOPoint.CreateDigitalOutput(controller.NetworkNodeGet(NODE_INDEX), OUTPUT_INDEX);
// set the output to false
output0.Set(false);
Console.WriteLine($"Output {OUTPUT_INDEX} set to: false");
// wait one sample for the change to take effect
controller.SampleWait(1);
// read back the value
bool outputValue = output0.Get();
Console.WriteLine($"Output {OUTPUT_INDEX} value: {outputValue}");
// set the output to true
output0.Set(true);
Console.WriteLine($"Output {OUTPUT_INDEX} set to: true");
controller.SampleWait(1);
outputValue = output0.Get();
Console.WriteLine($"Output {OUTPUT_INDEX} value: {outputValue}");