APIs, concepts, guides, and more

Example of using IO point in Python. Useful information about enum conversions.


📜 IO Point

def test_iopoint(self):
creation_params:RapidCode.CreationParameters = helpers.get_creation_parameters()
motioncontroller:RapidCode.MotionController = RapidCode.MotionController.Create(creation_params)
helpers.check_errors(motioncontroller)
INPUT_INDEX = 0
OUTPUT_INDEX = 1
user_buffer_address = motioncontroller.AddressGet(RapidCode.RSIControllerAddressType_RSIControllerAddressTypeUSER_BUFFER, 0)
input0 = RapidCode.IOPoint.CreateDigitalInput( motioncontroller, user_buffer_address, INPUT_INDEX)
output0 = RapidCode.IOPoint.CreateDigitalOutput( motioncontroller, user_buffer_address, OUTPUT_INDEX)
output0.Set(False)
assert not output0.Get(), "The getter function should return a value equal to false"
output0.Set(True)
assert output0.Get(), "The getter function should return a value equal to true"
motioncontroller.MemorySet(input0.AddressGet(), 0)
assert not input0.Get(), "The getter function should return a value equal to false"
motioncontroller.MemorySet(input0.AddressGet(), 1)
assert input0.Get(), "The getter function should return a value equal to true"
motioncontroller.Delete()

Learn more in settling topic page.