◆ IOGet()

virtual IO* IOGet ( int32_t  nodeNumber)
pure virtual

IOGet returns a pointer to an IO object using its node number and initializes its internals.

ℹ This function is avaliable in RapidCode

Part of the Create and Initialize RapidCode Objects method group.

Description:
IOGet takes a node reference number and returns a pointer to the IO object it represents.
Parameters
nodeNumberThe reference number of the node the IO is on. The first I/O node is the 0th Node. Non-I/O Nodes are not considered for this numbering schema.
Returns
(IO*) A pointer to the IO specified.
Sample Code:
IOPoints
//---Arrange---
const int NODE_INDEX = 0; // The EtherCAT Node we will be communicating with
//const int INPUT_INDEX = 0; // The PDO Index in that Node
const int OUTPUT_INDEX = 0; // The PDO Index in that Node
//IOPoint input0 = IOPoint.CreateDigitalInput(controller.IOGet(NODE_INDEX), INPUT_INDEX); // Automatically gets the memory index of a specified node and input index
IOPoint output0 = IOPoint.CreateDigitalOutput(controller.IOGet(NODE_INDEX), OUTPUT_INDEX); // Automatically gets the memory index of a specified node and input index
//---ACT---
output0.Set(false);
//---ASSERT---
controller.SampleWait(1);
Assert.False(output0.Get(), "The getter function should return a value equal to false");
Note
SynqNet assigns a logical number to each I/O node that it encounters during initialization. This number will be consistent as int32_t as the SynqNet Node's relative location on the network remains the same.
Examples
SingleAxisSyncOutputs.cpp, Template.cpp, and UserLimitDigitalInputAction.cpp.