APIs, concepts, guides, and more
io-general-purpose.cs
Note
See IO: Input & Output 📜 for a detailed explanation of this sample code.
Warning
This is a sample program to assist in the integration of the RMP motion controller with your application. It may not contain all of the logic and safety features that your application requires. We recommend that you wire an external hardware emergency stop (e-stop) button for safety when using our code sample apps. Doing so will help ensure the safety of you and those around you and will prevent potential injury or damage.

The sample apps assume that the system (network, axes, I/O) are configured prior to running the code featured in the sample app. See the Configuration page for more information.
/* This sample demonstrates how to access General Purpose IO on EtherCAT network nodes.
Shows how to read and write digital and analog inputs/outputs.
Requires an EtherCAT network with nodes that have IO.
*/
using RSI.RapidCode; // RSI.RapidCode.dotNET;
Console.WriteLine("📜 IO: General Purpose");
// get rmp objects
try
{
Helpers.CheckErrors(controller);
// get node
var node = controller.NetworkNodeGet(nodeNumber: 0);
Helpers.CheckErrors(node);
// digital io
bool dIn = node.DigitalInGet(digitalInNumber: 0);
bool dOut = node.DigitalOutGet(digitalOutNumber: 0);
node.DigitalOutSet(digitalOutNumber: 0, state: dOut);
// analog io
int aIn = node.AnalogInGet(analogChannel: 0);
int aOut = node.AnalogOutGet(analogChannel: 0);
node.AnalogOutSet(analogChannel: 0, analogValue: aOut);
Console.WriteLine($"Digital Input 0: {dIn}");
Console.WriteLine($"Digital Output 0: {dOut}");
Console.WriteLine($"Analog Input 0: {aIn}");
Console.WriteLine($"Analog Output 0: {aOut}");
}
// handle errors as needed
finally
{
controller.Delete(); // dispose
}
static MotionController * Get()
Get an already running RMP EtherCAT controller.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
Definition rsi.h:800
Helpers namespace provides utility functions for common tasks in RMP applications.
Definition helpers.h:21